
Guillaume Melquiond wrote:
Le mardi 11 juillet 2006 à 14:21 +0300, Peter Dimov a écrit :
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.
Your reasoning is a bit flawed, since this property is also true for the lexicographic order.
Yes, you and Martin Bonner are right, and I am wrong on that.
complex<double> struct { double x, double y; } pair<double, double> tuple<double, double> vector<double> vector<char> string
Any set of computer data can be ordered. I don't think it means that they should all have an operator<.
Yes of course. So which types should have an operator< and which should not?