It\'s often useful in C++ to work with lambdas and function objects, rather than function pointers. The reason being that a lambda\'s or function object\'s type fully encodes wh
If you just want to wrap a function pointer in a function object, I'd recommend a macro:
#define WRAP_FN(f) [](auto&&... args) -> decltype(auto) { \
return f(std::forward(args)...); };
To be used like:
auto lam = WRAP_FN(foo);
The advantage of the macro is that it'll additionally handle overloaded names - so that you can pass overloaded functions into std algorithms and have that do what you want it to.