Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-04-01 09:24:53


On Tue, Apr 1, 2008 at 3:03 AM, shunsuke <pstade.mb_at_[hidden]> wrote:
> Giovanni Piero Deretta wrote:
> > 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.
>
> BTW, Boost.Egg has the potential to implement your compose.
>
> typedef result_of_lazy<fold>::type fold_;
> typedef result_of_lazy<reverse>::type reverse_;
> typedef return_of<fold_(reverse_(T_bll_1), T_bll_2, T_bll_3)>::type reverse_fold;
>

Oh! So Egg has the functionality to make function objects directly
usable in lambda expressions (without bind)???
i.e.

for_each(range_of_ranges, regular(protect(std::cout << accumulate(ll::_1, 0))))

does that actually work? (for appropriate definitions of for_each and
accumulate, of course).
I was going to ask you to provide this functionality in egg (yes, I'm
working on a review :) )
BTW, i prefer to spell 'regular(protect(...))' as 'lambda[...]'

> A showstopper is that it is difficult to offer static-initialization way.
>

Even if I guarantee that my function objects (in this case fold and
reverse) are stateless? Does using the lambda placeholders complicate
things?

-- 
gpd

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