Summary: Possible bug in compiler or documentation regarding
signature of opCmp()
--- Comment #0 from ku...@mailinator.com 2011-11-14 13:07:07 PST ---
The documentation http://www.digitalmars.com/d/2.0/arrays.html writes that "For
the .sort property to work on arrays of structs or unions, the struct or union
definition must define the function: int opCmp(S) or int opCmp(S*)". That is
misleading, as, in my experience, a struct must implement exactly "int
opCmp(ref const S) const" in order to get .sort work. Signatures which are a
bit different do not work.
The documentation should be updated as soon as possible, either informing the
programmer about a current bug in the compiler, or clearly stating that only
this signature works! In addition, I think that the compiler should warn about
using a likely incorrect signature.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------