
On 03/11/09 16:20, Larry Evans wrote:
On 03/11/09 12:07, Larry Evans wrote:
On 03/11/09 11:38, Steven Watanabe wrote: [snip]
Finally, when you use a lambda expression inside another lambda expression, you need to wrap it in protect.
Steven, I tried that, but got an error, which lead me finally to the lambda<Op>::type::apply<,> solution shown below. [snip]
So, the fold.html docs are wrong and could be corrected by changing:
apply<op,_1, deref<_2> >
to:
lambda<op>::type::apply<_1,deref<_2> >
, or am I missing something else.
Apparently I was missing something because the page: http://www.boost.org/doc/libs/1_38_0/libs/mpl/doc/refmanual/apply.html Says for any _Lambda Expression_ f and arbitrary type a1,...,an: typedef apply<f,a1,...,an>::type t is equivalent to: typedef apply_wrap< lambda<f>::type,a1,...,an>::type t; and the page: http://www.boost.org/doc/libs/1_38_0/libs/mpl/doc/refmanual/apply-wrap.html says for any _Metafunction Class_ f and arbitrary types a1,...,an: typedef apply_wrap<f,a1,...an>::type t; is equivalent to: f::apply<a1,... an>::type t; so, the fold.html expression: apply<op,_1, deref<_2> > is equivalent to: apply_wrap<lambda<op>::type, _1, deref<_2> > is equivalent to: lambda<op>::type::apply<_1, deref<_2> >::type which is the exact expression I got to work; yet, just coding: apply<op, _1, deref<_2> > doesn't work. Maybe there's a bug in the compiler I'm using? It's gcc-4.4 or gcc-4.1. Anybody else having this problem with another compiler? TIA. -Larry