Boost logo

Boost Users :

From: Jason House (jasonhouse_at_[hidden])
Date: 2006-09-30 23:18:19


Jason House wrote:
> I'm trying to convert the input argument to a function object using a
> small helper function object. The code below looks relatively simple,
> but it doesn't seem to compile. Any ideas what could be wrong?
>
> template<typename inputType, typename outputType>
> boost::function<outputType (int)>
> convert(boost::function<outputType (inputType)> &object_to_convert){
> boost::function<intputType (int)> input_converter(...);
>
> // The following fails to compile
> boost::function<outputType (int)> converted_function
> (boost::lambda::bind(object_to_convert, input_converter));
>
> return converted_function
> }

I realize the use of local variables in the object creation is a bad
idea, but that doesn't affect the compilation.

While I get buried in "instantiated from here" messages, here's the
actual error message (altered to match the example)

/usr/local/include/boost/lambda/detail/function_adaptors.hpp:41:
error: no match for call to
'(const boost::function<outputType()(inputType),std::allocator<void> >)
  (const boost::function<outputType()(int), std::allocator<void> >&)'


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net