|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-11 07:21:07
Martin Bonner wrote:
> ----Original Message----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Peter Dimov
>
>> Daryle Walker wrote:
>>
>>> [1] If you make a fake order for "std::complex<>", would you compare
>>> real components then imaginary components, or would you use
>>> magnitude then angle?
>>
>> Real, then imaginary. Compare with:
>
> Interesting. I would have chosen magnitude and then angle. Why
> components.
There are two reasons for that. First, composite types use lexicographical
ordering by default, and std::complex is (de facto) a (real, imag) pair.
Second, the magnitude/angle ordering has the property that if you have three
numbers a, b, c, where a and b are very close to one another but not to c,
it is possible to have a < c and c < b.
>> "If you make a FAKE order for std::string, would you compare left to
>> right or right to left?"
>
> I don't think that is a legitimate comparison. In my world view,
> strings have a natural order but complex numbers don't.
Possibly. So you define "fake" as "unnatural", and define "natural" as
"feels natural to me". This approach can work but it's a bit subjective,
isn't it?
Consider the progression:
complex<double>
struct { double x, double y; }
pair<double, double>
tuple<double, double>
vector<double>
vector<char>
string
If we take the "feel" of operator< out of the equation, where should we draw
the line, and based on what?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk