Boost logo

Boost :

Subject: [boost] Fwd: review request: addition to type_traits library of is_less_comparable<T> and others
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2009-08-31 12:01:14


Anybody wanting to review this very short addition to type_traits?

I can add that one important question of the review is: should we
report that T is less comparable if T<T returns void?
Currently it returns true but the implementation generates warnings in
g++. However, I imagine that if someone wants to know if T<T works, it
is to get the result (this is my use of it).

Regards,

Frédéric

De : Frédéric Bron <frederic.bron_at_[hidden]>
Date : 10 août 2009 21:29
Objet : review request: addition to type_traits library of
is_less_comparable<T> and others
À : boost_at_[hidden]

Hi folks,

I would like to propose to your review the following addition to the
type_traits library. The addition is attached to this email and also
available in the sandbox at
https://svn.boost.org/trac/boost/browser/sandbox/type_traits
The purpose of the addition is to add type traits to detect if type T
is comparable in the sens of <, <=, >, >=, == or != operators, i.e. if
t1<t2 has a sens when t1 and t2 are of type T (same for <=, >, >=, ==,
!=).

The following traits are added:

is_equal_to_comparable<T>
is_greater_comparable<T>
is_greater_equal_comparable<T>
is_less_comparable<T>
is_less_equal_comparable<T>
is_not_equal_to_comparable<T>

The names are based on the corresponding names of the standard
template library (<functional> header, section 20.3.3 of the
standard).
The compilation has been tested with g++ 4.3.2 and icpc 10.0 on linux
64 bits, g++ 3.4.4 on cygwin, mingw32 3.4.4 on cygwin.

I must add that I did not invent the code (I obtained some help from
the boost mailing list) but I put it together in a form that should be
acceptable to boost.

Regards,

Frédéric




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