Passing any function as template parameter
It’s now possible in C++17 with template<auto>: template<auto Func> struct FuncWrapper final { template<typename… Args> auto operator()(Args &&… args) const { return Func(std::forward<Args>(args)…); } }; int add(int a, int b) { return a + b; } int main() { FuncWrapper<add> wrapper; return wrapper(12, 34); } Demo: https://godbolt.org/g/B7W56t You can use #ifdef __cpp_nontype_template_parameter_auto to detect compiler … Read more