[Issue 7864] Structs with class members can't be sorted
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 9 10:42:06 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7864
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #2 from bearophile_hugs at eml.cc 2012-04-09 10:42:47 PDT ---
(In reply to comment #1)
> If you change opCmp signatures to:
>
> int opCmp(const S rhs) const
> int opCmp(const ref S rhs) const
> // may work in general
Maybe one opCmp is enough in general:
struct S {
C c;
int opCmp()(const auto ref S rhs) const {
if (c < rhs.c) return -1;
if (c > rhs.c) return 1;
return 0;
}
}
--
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