Boost logo

Boost :

Subject: Re: [boost] [mpl][fold.html] apply<op, _1, deref<_2> > correction needed.
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2009-03-16 02:34:08

Hi Larry,
> I'm not saying there's a bug in either. I'm claiming
> there's a documentation bug.

You are right, please see below.

>> Finally, when you use a lambda expression
>> inside another lambda expression, you need
>> to wrap it in protect.
>> mpl::apply<mpl::apply<op_meta_fun_elem<_1, _2>, _1, mpl::deref<_2> >,
>> state0, iter0>::type
>> is guaranteed to behave strangely, because all the placeholders
>> will be substituted by the outermost apply.
> So the documentation in fold.html should have used protect
> somewhere in apply<op,_1, deref<_2> >?

Nope, it should have been

   typedef iter_fold<s,state,apply2<lambda<op>::type,_1,deref<_2> > >::type
                                  ^ ^^^^^^^^^^^^^^^^

That is:

   - 'apply2' instead of 'apply' to workaround "apply + lambda +
      ( and

   - 'lambda<op>::type' instead of 'op' to prevent 'op' from being treated
      as an integral part of the 'apply2< ...,_1,deref<_2> >' lambda

Fixed in the doc sources in the trunk

Thanks for the report!

Aleksey Gurtovoy
MetaCommunications Engineering

Boost list run by bdawes at, gregod at, cpdaniel at, john at