C++0x, How do I expand a tuple into variadic template function arguments?
Posted
by
Gustaf
on Stack Overflow
See other posts from Stack Overflow
or by Gustaf
Published on 2009-03-26T20:43:34Z
Indexed on
2011/06/24
8:22 UTC
Read the original article
Hit count: 217
Consider the case of a templated function with variadic template arguments:
template<typename Tret, typename... T> Tret func(const T&... t);
Now, I have a tuple t of values. How do I call func() using the tuple values as arguments? I've read about the bind() function object, with call() function, and also the apply() function in different some now-obsolete documents. The GNU GCC 4.4 implementation seems to have a call() function in the bind() class, but there is very little documentation on the subject.
Some people suggest hand-written recursive hacks, but the true value of variadic template arguments is to be able to use them in cases like above.
Does anyone have a solution to is, or hint on where to read about it?
© Stack Overflow or respective owner