Possible duplicate:
"unzip" the tuple to call the corresponding function pointer
I create a closure object to wrap the function and its parameters in order to create a zero parameter functor:
template<typename Function, typename... Args>
struct closure
{
closure(Function f, Args... args)
: f(f),args(args...)
{}
void operator()()
{
apply_from_tuple(f,args);
}
Function f;
std::tuple<Args...> args;
};
What is the most concise way to build a function apply_from_tuple?
source
share