Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-12-30 11:47:59


On Sat, 30 Dec 2000, David Abrahams wrote:
abraha> How about StrictWeakOrdered or StrictWeakComparable?

Matt Austern's book already has concepts with the above names. The SGI STL
LessThanComparable requires a partial ordering, while the above concepts
require the stronger strict weak ordering.

abraha> My only real problem with plain "Comparable" is that it's overgeneral. That
abraha> is, if you can ask "a == b?" you have compared a and b, meaning that they
abraha> were comparable. The concept doesn't cover equality comparison, though.

Good point.

Hmm, lets take a step back and look at the whole picture.

Syntactic requirements:
  Level 1: a < b
  Level 2: a < b, a <= b, a > b, a >= b
 
Mathematical requirements:
  Level 1: partial ordering
  Level 2: strict weak ordering
  Level 3: total ordering

Here's a summary of already defined concepts:

The Standard LessThanComparable has Level 1 syntactic and
  Level 2 mathematical requirements.

The SGI STL LessThanComparable has Level 2 syntactic and
  Level 1 mathematical requirements.

The SGI STL StrictWeaklyComparable has Level 2 syntactic
  and Level 2 mathematical requirements.

Actually, upon close inspection I like your suggestion of using
StrictWeaklyComparable as what gets implemented by our helper. The helper
should take something that is LessThanComparable (according to the
Standard) and add more operators, making it StrictWeaklyComparable. Since
the input is LessThanComparable, it already has the strict weak ordering,
so it would not make any sense to go backwards to a partial ordering.

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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