From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-04-01 19:59:48
Giovanni Piero Deretta wrote:
>> 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)???
> 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 :) )
Yes. egg::lazy/nestN makes bind/protect deprecated.
I've noticed that bind/protect is a customization point.
X_lazy<T_boost_bind> bb_lazy; // T_boost_bind represents boost::bind.
In fact, implementing T_boost_bind is so difficult that Egg skips it. :-)
> BTW, i prefer to spell 'regular(protect(...))' as 'lambda[...]'
What is `regular`? Is it the same as egg::regular?
BTW, everything must be function-call to support result_of.
> Even if I guarantee that my function objects (in this case fold and
> reverse) are stateless? Does using the lambda placeholders complicate
If fold_ is DefaultConstructible and a default-constructed one is callable,
it would be:
return_of<T_regular(fold_(reverse_(T_bll_1), T_bll_2, T_bll_3))>::type
I tend to hesitate to use result_of/return_of without function-calls.
So your `compose` may be a candidate of yet another lambda framework.
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk