Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-03-31 10:29:23


On Sun, Mar 30, 2008 at 11:18 PM, shunsuke <pstade.mb_at_[hidden]> wrote:
> Giovanni Piero Deretta wrote:
> > OTOH, refactoring a lambda on a separate function object is a pain if
> > you have to figure out the result of a complex composition
> > of polymorphic function objects (result_of helps only to a point). For
> > example, what is the result of:
> >
> > filter_view(reverse_view(mapped_view(range, op)), filter)
> >
> > (I often find much more complex expressions in my code).
>
> BTW, how about this:
> http://tinyurl.com/23jdk6
> return_of is a simple wrapper around result_of.

Ah, yes, basically recursive evaluation of result_of. I have it in my
bag of tools (and as an added benefit, is boost::lambda, compatible,
but I guess return_of is too); it still bothers me to have to write an
expression two times, one to deduce the result_type and one to
actually compute the value. And it seems that things won't improve
much with decltype [1].

This is in fact the reason for my compose<> template idea: If you
can't avoid writing a type expression, you might as well just write
that.

[1] it would be great if we also had the automatic one-line-lambda
result type deduction in normal functions (and polymorphic lambdas
too, but that's another story :( ).

-- 
gpd

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