
Is there a way to make a boost::lambda functor adaptable, that is to make it define result_type? There is a ret<> function template that lets one specify the result type, but the returned functor still does not have result_type typedef. I've encountered the problem trying to use boost::transform_iterator with a boost::lambda functor: std::vector<int> intVect; boost::make_transform_iterator(intVect.begin(), boost::lambda::_1 / 2); transform_iterator<> does not compile comlaining the functor does not have result_type. As a workaround I had to write something like: template<class R, class T> struct result_type_wrapper : T { typedef R result_type; result_type_wrapper(T const& t) : T(t) {} }; template<class R, class T> inline result_type_wrapper<R, T> result_type(T const& t) { return t; } boost::make_transform_iterator(intVect.begin(), result_type<int>(boost::lambda::_1 / 2)); Am I missing something? Is there a way to avoid using result_type_wrapper<>? -- Maxim Yegorushkin