From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-04-28 15:10:15
Daniel Walker wrote:
> On 4/28/07, Peter Dimov <pdimov_at_[hidden]> wrote:
>> Daniel Walker wrote:
>>> So, you mean that Bind is definitely going to overload the
>>> relational operators.
>> Bind already overloads the relational operators:
> Aha, that was the source of my confusion. I'm not so worried about
> bind(f, _1) < x. This already works even when the lambda header is
> included. Moving forward, I think breaking this code can be avoided.
> I'm worried about bind(f, _1 < x) or bind(f, _1) < _2.
bind(f, _1) < _2 is also handled by Bind.
>> in more limited contexts. It is trivial to extend this overloading
>> to work on expressions that involve no bind calls such as _1 == 5,
>> _1 > _2 or !_4 - provided that the placeholders aren't inline
>> functions, of course. :-)
> It's also trivial to make lambda generate is_bind_expression
> specialized functors. I think one or the other of the libraries should
> take care of this use-case but not both, just to avoid the head aches.
This is how I think it should work:
boost::bind(...) relop ...: Bind (as today)
_1 relop ...: Bind, translates to boost::bind( __relop(), _1, ... )
!_1: Bind, translates to boost::bind( __not(), _1 )
_1 + ...: Lambda (based on is_placeholder<>)
ll::bind( f, _1 ): as above
boost::bind(...) + ...: Lambda (based on is_bind_expression<>)
ll::_1 relop ...: Lambda or Bind - TBD
!ll::_1: Lambda or Bind - TBD
boost::bind( f, _1 + _2 ): won't work with boost::bind; should work with
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk