[Issue 7430] opCmp doesn't support unordered value comparison.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 3 12:55:23 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7430
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> 2012-02-03 12:55:20 PST ---
"a @ b is rewritten as a.opCmp(B) @ 0"
And there you have it. What return type and value for opCmp fulfills this
requirement? I'll tell you: float and nan.
Example:
struct Foo {
float opCmp(Foo other) {
return float.nan;
}
}
unittest {
assert( !(Foo() < Foo() ));
assert( !(Foo() <= Foo()) );
assert( !(Foo() > Foo() ));
assert( !(Foo() >= Foo() ));
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list