Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-08-23 02:41:50


On Thursday, August 21, 2003, at 10:12 PM, Beman Dawes wrote:

> At 06:38 PM 8/21/2003, David Abrahams wrote:
>
>> I need to make a mapping over paths. Is there any important reason
>> there's no operator< provided?
>
> I don't think it has been discussed. I've had the need myself, but
> worked around it by using path::string() to generate the key.
>
> There were a number of discussions about operator== and !=. They can
> be subject to serious abuse and misunderstanding, and so are left out.
> I'm still not sure if that was the right decision, so might be willing
> to review it.
>
> Anyhow, we should be able to support maps and sets of paths. I'll try
> to give it some thought in the morning when I'm wider awake.

If it isn't safe to even have the equality operators, then having the
ordered inequality operators may not be safe either. If David has an
ordering he wants to use in mind, then a custom comparison function
object class can be made.

I've seen quite a few requests for operator<() for class that don't
have it (e.g. std::complex<>) just for the purpose of using it as an
element type of an associative container. Forcing a type of have such
an operator, even when it's inappropriate (i.e. the type doesn't
suggest an overwhelmingly-natural ordering), defeats the purpose of the
associative container class templates having comparator types in the
first place!

Daryle


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