
4 Jul
2006
4 Jul
'06
7:41 a.m.
Hi, I'm desperately seeking for doing this conversion using the boost libraries. User code often provides a function pointer, while library code often works with function types. For example (function_conversion does the 'magic' here): int foo(int); template<class T, class R = typename function_conversion<T>::type > boost::function<R> function_wrapper(T t) { return boost::function<R>(t); } Such that the user can write: function_wrapper( &foo )(1); Thus no longer needs to specify the int(int) function type to boost::function. Is it possible to construct such a 'function_conversion' type ? Any answer is greatly appreciated, Peter -- Peter Soetens -- FMTC -- <http://www.fmtc.be>