I am struggling with challenging, but yet simple problem. Let say that I have a target function as follow
void target_fnc(int arg1, double arg2)
{ /* do something here */ }
and what I would like to "extract" is the variable names (i.e. 'arg1', 'arg2'). It is trivial to fetch this information for a variable with some preprocess, for instance
#define PRINTER(name) printer(#name)
void printer(const std::string& name) {cout << name << endl;}
and I can also use variadic macros in case of multiple variables
#define PRINTER2(names...) printer(#names)
printer(arg1,arg2)
but I don't have any clue of how to "extract" from a target function..for instance, using variadic templates tecniques as follow
template <typename ...A>
void extract(void (*)(A...))
{ printer(A...); }
It won't work: I will obtain 'A...' and not the unpacked variables, of course... Any tips?
Thanks! Note: I'm using C++11, gcc 4.8.1