From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-09-06 07:18:52
On 6 Sep 2002, Gabriel Dos Reis wrote:
> Guillaume Melquiond <gmelquio_at_[hidden]> writes:
> | I can imagine a lot of situations where somebody would like to use
> | intervals as keys. However I don't really see a case where it is needed
> | to have another order than the lexicographic one.
> For intervals in general, me neither.
> | In particular, if the
> | intervals don't overlap, it can be used as a positional relation.
> | Could you explain what kind of order you need in your example about the
> | roots of a polynomial?
> I didn't say I needed a *particular* order; what is important is the
> _ability_ to use it as a key. Yes, one can define one each time one
> needs it (I used the lexicographical compare).
> Similar arguments would apply for pointers (in general) also, but it
> is much more convenient to say std::map<T*, U>, than
> std::map<T*, U, MyCompare> when the exact ordering MyCompare doesn't
> really matter.
My opinion on this two points are the same as yours: the lexicographic is
the only useful order for interval keys in the genral case; and it should
be better if we didn't have to specify it whenever we create an ordered
So maybe it's time to put back 'less< interval<...> >' and to define it
with the lexicographic order. But as someone (sorry to say "someone", I
can't find the mail anymore) pointed it, 'less' should be equivalent to
However, one of the predefined comparison policy class is the
lexicographic order. So, if the interval type has been defined by using
this policy, there is no more problem. The operator '<' will then be the
lexicographic order and 'std::map' will be happy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk