I'm looking for a way in C++ to extract the return type of a function (without calling it). I presume this will require some template magic.
float Foo();
int Bar();
magic_template<Foo>::type var1; // Here 'var1' should be of type 'float'
magic_template<Bar>::type var2; // and 'var2' should be of type 'int'
I am currently investigating how magic_template
might be implemented, but have not found a solution so far.
Any ideas?