News for hackers. Stuff that matters.
Re:Template Metaprogramming with Modern C++: templates in depth by ambrop7 on Monday September 29, 2014 @11:34AM (#8383362)
The clean approach is to wrap functions into classes:

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.

Re:Template Metaprogramming with Modern C++: templates in depth by cbsmith on Monday September 29, 2014 @12:15PM (#8383543)
But you don't get much by wrapping it in that class and making a functor out of it, unless you want to manage state. Either way, in C++, it is a slim line between the two.

C++11 lambdas have this quality of "a type for every function" as well.