class Wrap { void call() {...} };
template <typename F> { ... F::call(); }
And with some imagination one can write a macro to do this wrapping given an existing function, used like this:
void my_func();
using MyFuncWrapped = WRAP_FUNC(my_func);
// Now MyFuncWrapped::call() calls my_func.
My implementation of the wrapper: https://github.com/ambrop72/aprinter/blob/master/aprinter/me... . But note it doesn't use std::forward since this code assumes no references being used.
C++11 lambdas have this quality of "a type for every function" as well.
class Wrap { void call() {...} };
template <typename F> { ... F::call(); }
And with some imagination one can write a macro to do this wrapping given an existing function, used like this:
void my_func();
using MyFuncWrapped = WRAP_FUNC(my_func);
// Now MyFuncWrapped::call() calls my_func.
My implementation of the wrapper: https://github.com/ambrop72/aprinter/blob/master/aprinter/me... . But note it doesn't use std::forward since this code assumes no references being used.