|
Boost : |
From: Florian Stegner (FlSt_at_[hidden])
Date: 2005-08-18 09:43:03
David Abrahams wrote:
> Rob Stewart <stewart_at_[hidden]> writes:
>>
>> 1 seems pretty good because the two-character operators stand
>> out well. 2 works pretty well, but I'm concerned that the
>> operators may get lost if the predicate is a specialization of
>> a template type; the template argument list uses the same
>> tokens. (1 is better in that case because of the doubled
>> tokens.)
>
>
> None of them look right to me. Unless you close up the spaces next to
> some_predicate(), they appear to be doing what the usual C++ operators
> do. a < b looks like less-than; a <b immediately starts to suggest
> something else.
Hmm.. << >> would be look ok for me, because multivalues don´t provide
arithmetic operations and they can't be misunderstood in this context.
But at all, I don´t like this misuse of operator overloads, because it
can lead into complex and confusing compiler error messages. My appraoch
is still to provide a simple predicate-function like compare( all_off( a
), pred(), any_of( b ) ). This has also the advantage, that there are no
ambigous problems with operator overloads of lambda expressions, which
occour if you write something like
all_of( a ) << lambda::_1 > lambda::_2 >> any_of( b ).. Where also
parentheses don't help.
Sincerely
Florian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk