
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.