Boost logo

Boost :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2006-03-02 08:58:39


Hi!

Currently, apply does not meet the criteria for a Placeholder Expression
because the number of template parameters is one too many. Still, I
think it would be useful to be able to use apply as a lambda expression.

For my use case, I needed a lazy metafunction that took a function and
its argument, evaluating the passed function with the argument. My
initial approach to this was to use

     lambda<apply<_2, _1> >::type

this approach failed, it turns out, because lambda returns apply<_2, _1>
unchanged, while I expected to get

     protect<
         bind2<
             quote2<apply>,
             arg<2>,
             arg<1>
>
>

A simple workaround is to use apply1, instead or to directly use the
expression above, which diminishes code readability.

Would it be possible and desirable to give apply special treatment in
lambda, if only to avoid surprises in similar use cases?

Best regards,

João


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