Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-09 15:57:39


"Thorsten Ottosen" <nesotto_at_[hidden]> wrote in message
news:chqcic$joc$1_at_sea.gmane.org...
> Dear all,
>
> Another small issue have surfaced regarding operator==(), operator!=() and
> operator<() (the latter currently not there).
>
> The current behavior is compare the two underlying iterators. I would suggest
> to change this to compare the objects in the underlying range.
> The motivation would be the follwoing:
>
> 1. comparing the iterators is seldom useful and can be done explicitlty or by
> a new member function equal()
> 2. comparing the objects is the range is highly useful and allows for code
> like
>
> sub_range<string> sub = ...;
> if( sub == "foo" )

Wouldn't it be natural to define a collection-oriented version of std::equal
from <algorithm> to perform this test?

> 3. operator<() cannot be defined for iterators in general and hence we
> couldn't put iterator_range into a set/map;

Would this be a lexicograpkical comparison?

Jonathan


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