Boost logo

Boost :

Subject: Re: [boost] [type_traits] adding is_less_comparable<T>, etc.
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-08-31 13:32:09


[subject adjusted a bit]

Frédéric Bron wrote:
>
> Anybody wanting to review this very short addition to type_traits?

remove_cv.html is not in the archive (the link from index.html was broken).

The links for the additions are not in alphabetical order on index.html.

Even if you didn't invent the code, you assembled and documented it, so your name should be in the copyright notice (in the documentation), right? Add others to the list as you think appropriate.

Your HTML formatting differs from the original, though that could be the means by which it was generated rather than a difference in the formatting of your files.

Your content will appear in a single page, reference.html, if added to Boost.TypeTraits, so why create separate pages now?

The description of is_greater_comparable should be more specific:

   If a value of type T can be compared with another using
   operator > to determine whether the first is greater than
   the other, then inherits from true_type, otherwise
   inherits from false_type.

That rewrite anticipates the question you asked, below.

I think is_greater_than can be less restrictive than it is. std::greater() provides an operator that permits comparing unrelated types as T's. Therefore, I wonder if this would work:

   template <class T, class U = T>
   struct is_greater_comparable;

Then, is_greater_comparable<int, float> would inherit from true_type.

Similar changes would apply to the other comparison types.

> I can add that one important question of the review is: should we
> report that T is less comparable if T<T returns void?

I think that is not appropriate as the whole point of less-than-comparable is to be able to determine whether one instance is less than another, not that "operator <" is supported.

The same applies to the other comparison operators.

_____
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.


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