
In c++0x, creating a generic function wrapper is a bliss: template <typename Func> class gen_wrapper { Func && func_; public: gen_wrapper(Func && in) : func_(in) {} template <typename ... Prms> /*deduce result here */ operator() (Prms && ... prms) { //Do something special here. //NOTE: we can operate with arguments here too return func_(std::forward<Prms>(prms)...); } }; That's it. But if I don't have C++0x, can boost help here? functional/forward_adapter won't work since it hides function parameters, it only lets you operate with the function. It looks like it may be possible to do that by using boost/preprocessor I'll have to generate a whole lot of overloads with O(2^N) (because of the overload on (T &) or (T const &) for every argument). But it looks pretty dounting. It's basically what forward_adapter had to do. Isn't there a ready-made library that would allow me to generate all of the overloads? Thanks, Andy.