[Issue 4290] 'Fragile' opCmp/toHash signature errors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 15 21:26:51 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4290
Kevin Bealer <kevinbealer at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kevinbealer at gmail.com
--- Comment #1 from Kevin Bealer <kevinbealer at gmail.com> 2010-09-15 21:26:18 PDT ---
Just ran into this as well; also, note that the page here gives the wrong
version of the signature; it omits the critical const, so anyone running into
this problem will be misguided.
http://www.digitalmars.com/d/2.0/operatoroverloading.html#compare
Also... it looks like some of the standard code such as in std.bitarray does
this without the "const", so I imagine the standard library is broken, though I
haven't tested whether bitarray's sort properly.
I agree with bearophile's recommendation -- there is no value in accepting a
signature for "standard" interfaces like opCmp that will not work.
One other detail: both of the opCmp signatures seem to work when "<" is used,
but for some reason, not with .sort. ??
I'm testing with 2.048.
Thanks,
Kevin Bealer
--
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