Subject: Re: [boost] review request: addition to type_traits library of is_less_comparable<T, U> and others
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-12-07 13:49:50
Christian Schladetsch wrote:
> On Mon, Dec 7, 2009 at 9:12 PM, John Maddock
> <john_at_[hidden]> wrote:
> > operator name in <functional> proposed name (existence)
> >> proposed name (existence and non void return type convertible to
> >> something)
> >> < less has_operator_less
> >> operator_less_has_standard_behaviour
If there were reason to keep it, I'd suggest something more like "std_operator_less," but that suggests a Standard-mandated interface, which there isn't (for UDTs).
> > I don't like operator_less_has_standard_behaviour at all.
> > In fact is there really any point to it?
> > Why not simply:
> > has_operator_less<T, R = bool>
has_operator_less<T, U, R = bool> is nice.
> > Where R is the expected return type. In all but a
> > vanishingly small number of cases R will be bool.
> > If you really want to support the "don't care"
> > case for a return type, use has_operator_less<T, dont_care> where
> > "dont_care" is a special placeholder type that you define
> > (could use a better name though?).
I like the idea and the name, though perhaps "any" would work, too.
> Is "less ugly" than
> boost::operators::less::exists<T, R=bool>
> But is it 'better'?
It is more in keeping with the existing traits, so if the latter were offered, the former would still be appropriate.
> Using boost::operators::[name] has enough potential benefits
> that I don't see why it should be rejected so casually:
> * boost::operators::[tab]::[tab] works better with Intellisense
I'm sure that holds sway with many, but I don't care about it.
> * it is factored over the operators, which provides a common
> structure for all operators in a tree
The structure is nice, but "has_operator_<op>" with a return type template argument also provides structure.
> * it provides a single type that designates each operation
> uniquely. that is, operators can become first-class objects.
There may be significant value on this point.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.