On Thursday 31 October 2002 01:22 pm, hugo duncan wrote:
Is this possible? if so what signature should the function have ? //! this works fine passing a boost::function object template <class ReturnType> void add(const boost::function1
& arg) { boost::function1 fn_obj=arg; }
Generally speaking, it's not useful to have any of the template arguments to a Boost.Function object deduced, because it won't work the way you want it to.
//! this should work when passed the result of a boost::bind template <class ReturnType> void add(?what goes here? & arg) { function1
fn_obj(arg); } };
You could take the function object as a template paramter and extract its
result_type:
template<typename F>
void add(F arg)
{
typedef typename F::result_type ReturnType;
function1