
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)??? 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 :) )
Yes. egg::lazy/nestN makes bind/protect deprecated. I've noticed that bind/protect is a customization point. e.g. X_lazy<T_boost_bind> bb_lazy; // T_boost_bind represents boost::bind. bb_lazy(foo)(::_1, 2); 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 things?
If fold_ is DefaultConstructible and a default-constructed one is callable, it would be: typedef static_< mpl::always< return_of<T_regular(fold_(reverse_(T_bll_1), T_bll_2, T_bll_3))>::type > > reverse_fold; 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. Regards, -- Shunsuke Sogame