Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-27 12:12:03


Daniel Walker wrote:
> On 4/27/07, Peter Dimov <pdimov_at_[hidden]> wrote:

>> Yes, this is one of the reasons why boost::bind( ... ) == 5 is
>> valid, but _1 == 5 is not (the other being that given placeholder
>> interoperability, both Bind and Lambda will claim _1 == 5 as their
>> own.)
>
> Right. As long as lambda has it's own placeholders you'll need to
> disambiguate them with namespace qualification or using directives.

No, this wasn't what I had in mind.

Consider what would happen if boost::bind supplies a "proper" operator==( a,
b ) that attempts to return bind<bool>( __equal_to(), a, b ) and makes it
work not just when a or b is a bind() expression (as is the case today), but
for placeholders as well.

Lambda also has its operator== which does a similar thing, except that it
returns a lambda object.

If Lambda starts recognizing Bind's placeholders as its own, the two
operator== overloads (if visible) will both match ::_1 == 5. A similar
ambiguity would occur with ll::_1 == 5 if Bind recognizes ll::_1 as a
placeholder (which it already does).


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