Boost logo

Boost :

From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-09-06 09:50:42


On 6 Sep 2002, Gabriel Dos Reis wrote:

> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
> | less<> was decoupled from operator< for pointers and it went downhill from
> | there.
>
> Actually, it is the coupling of std::less<> with operator< that I see
> downhill. Just like pointers, there are useful datatypes out there for
> which it doesn't really make sense to have a general operator< but
> for which it would make sense to have a default std::less<>, for use
> with associtive containers fro example.

I don't think it is the coupling of 'std::less<>' with 'operator<' that is
bad. 'less' is just one of the "basic function object classes for all of
the comparison operators in the language" (C++ Standard 20.3.3). There is
also greater, greater_equal, not_equal_to, etc.

In my opinion, what is bad is that 'std::map' and alike use 'less' when no
comparison object is given. The Standard should probably have used another
function object than this one.

Just my 2 cents.

Guillaume


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