Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-27 19:11:36


Eric Niebler wrote:

> Although I don't know all the details of bind and lambda, I had hoped
> that _1 and _2 would be abstract proto entities, such that
>
> _1 == _2
>
> creates an expression template like:
>
> equal< terminal< arg<1> >, terminal< arg<2> > >
>
> which is a generic, abstract representation of an equals expression
> with two placeholders. Can't bind and lambda both be implemented to
> recognize such a type and do the appropriate thing with it?

Possibly, if they are made to honor is_bind_expression specializations and
result_of, if is_bind_expression reports true for the above type, if the
above is a function object that actually returns x == y, and if result_of
works for it.

> The only minor complication is that for the placeholders and
> expressions containing them, operator() must evaluate the expression
> rather than create a larger expression template. But that's trivial
> to do with proto.

Trivial? :-) Are you assuming variadic templates and decltype? Consider _9 -
_4 as one simple example.

Either way, if proto does evaluate, there would be no need for most of
Lambda.


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