Using <> for opCmp
Lionello Lunesu
lio at lunesu.remove.com
Fri Nov 24 04:32:09 PST 2006
The operator < > <= >= all use opCmp, but if you want to differentiate
between the three cases (< == >) you either have to call opCmp yourself
or use multiple comparisons.
I'd like to suggest using the operator <> for an implicit call to opCmp,
returning the actual comparison value (<0, 0, >0).
* <> is already valid and used (albeit for floats only ATM)
* if(x<>y) will work as supposed to without additional changes (in fact,
it already does**)
* no explicit reference to the hidden function "opCmp"
L.
**It seems that <> already works, but it returns a boolean true/false,
instead of an integer, so it currently is the same as !=.
More information about the Digitalmars-d
mailing list