Can't add perfect forwarding to wrapper function
While answering this question I wrote this working code, wrapping function passed in template arguments: template<typename Fn, Fn fn, typename... Args> auto wrapper(Args... args)->decltype(fn(args...)){ return fn(args...); } #define WRAPPER(FUNC) wrapper<decltype(&FUNC), &FUNC> Example usage (I use this code for testing): int min(int a, int b){ return (a<b)?a:b; } #include<iostream> using std::cout; int main(){ cout<<WRAPPER(min)(10, 20)<<'\n'; } Two people told me to use perfect forwarding . When I asked how to do this, one of them redirected me here . I read question, carefully read best