Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-06-10 15:08:41


On Thu, Jun 10, 2004 at 03:47:40PM -0400, David Abrahams wrote:
> "Maxim Yegorushkin" <e-maxim_at_[hidden]> writes:
> > David Abrahams <dave_at_[hidden]> wrote:
> >>> Am I missing something? Is there a way to avoid using
> >> result_type_wrapper<>?
> >> You could use boost::make_adaptable from
> >> boost/bind/make_adaptable.hpp, but there really ought to be a
> >> version of make_transform_iterator that does that for you.
> >
> > Shame on me. I knew about boost/bind/make_adaptable.hpp but I thought
> > it could only be used with a bind functor and did not give it a try.
> >
> > I wonder, why doesn't boost::lambda::ret<> privide that functionality
> > of boost::make_adaptable<>? It would certainly made sense and saved me
> > and hopefully other people from troubles.
>
> It can't. The result type of the lambda expression depends on its
> inputs. result_type is only one type. Adaptable functions are
> fundamentally non-polymorphic.

Maxim is talking about ret<>, which has a monomorphic type:

   http://www.boost.org/libs/lambda/doc/ar01s05.html#sect:overriding_deduced_return_type

I think it would be both possible and valuable for ret<T> and bind<T> to
define result_type.

-- 
-Brian McNamara (lorgon_at_[hidden])

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