Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-11-25 12:11:24

Hi John,

Well, if we really want to minimize the requirements for lower_bound
(which I agree in general is a very good idea) then we have to define
strict weak ordering in a much different way, or not require strict weak
ordering for lower_bound() and require something else.

The definition of strict weak ordering in 25.3 makes lots of uses of T < T
and value_type < value_type.

So does anyone know how to either:

1) create an alternate definition of strict weak ordering
 that only uses value_type < T.


2) create some alternate requirement (not strict weak ordering)
  that is enough to ensure lower_bound() will work.

I'm no expert on sorting, so I don't know if 1) or 2) is possible,
or what form they would take.


On Sat, 25 Nov 2000, John E. Potter wrote:
> We are talking about lower_bound? The only requirement to write the
> algorithm is iterator_traits<ForwardIterator>::value_type < T. Since
> there is only one object of type T available to the algorithm, it is
> nonsense to require T to be less than comparable. Conversions are
> evil and requiring one is bad. It is much more likely that value_type
> could be converted to T anyway.
> > if someone wants to add extra
> > signatures to the comparison operator to avoid unnecessary coversions then
> > that's OK, but I don't see LessThanComparable2<A,B> as being required here
> > (although it can't do any harm).
> Requiring anything that is not required does much harm. It makes the
> library harder to use for no reason. It is possible to write lower_bound
> using T < value_type and value_type < value_type and maybe even T < T,
> but the streight forward algorithm uses none of them and is optimal.
> Please stop trying to check concepts that do not exist. If the
> standard has a meaningless requirement, fix the standard, do not break
> the library.
> John

 Jeremy Siek www:
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906

Boost list run by bdawes at, gregod at, cpdaniel at, john at