Boost logo

Boost :

From: Peter Soetens (peter.soetens_at_[hidden])
Date: 2006-07-04 03:41:08


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>

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk