Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-06 06:16:36

Guillaume Melquiond <gmelquio_at_[hidden]> writes:

| On 6 Sep 2002, Gabriel Dos Reis wrote:
| > "David Bergman" <davidb_at_[hidden]> writes:
| >
| > | Wait,
| > |
| > | I agree with this case, brought forward by both Dave and Sylvain: that
| > | using intervals in STL in these "relational" positions, such as keys, is
| > | a bit strange.
| >
| > Suppose you want to locate zeros of polynomials. One practice is to
| > use intervals to provide boxes for the zeros (and their estimated
| > multiplicities). In such case, it makes sens to use known intervals
| > as keys for recording estimated zeros and astimates multiplicities.
| >
| > -- Gaby
| 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.

-- Gaby

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