Possible Duplicate:
“unpacking” a tuple to call a matching function pointer
I'm building a closure object to wrap a function and its parameters, to create a functor of zero parameters:
template<typename Function, typename... Args>
struct closure
{
closure(Function f, Args... args)
: f(f),args(args...)
{}
void operator()()
{
// call f using the tuple's elements as arguments
apply_from_tuple(f,args);
}
Function f;
std::tuple<Args...> args;
};
What's the most concise way to build the function apply_from_tuple
?