This is a follow up of this problem: Generic functor for functions with any argument list
I have this functor class (full code see link above):
template<typename... ARGS>
class Foo
{
std::function<void(ARGS...)> m_f;
public:
Foo(std::function<void(ARGS...)> f) : m_f(f) {}
void operator()(ARGS... args) const { m_f(args...); }
};
In operator()
I can access the args...
easily with a recursive "peeling" function as described in Stroustrup's C++11 FAQ
My problem is: I want to access the types of the arguments of f, i.e. ARGS...
, in the constructor. Obviously I can't access values because there are none so far, but the argument type list is somehow burried in f
, isn't it?