bug in std.algorithm.sort ??
A.M.
AMAMH3 at Gmail.com
Thu Jun 4 06:26:42 PDT 2009
KennyTM~ Wrote:
> No. Because comp("foo", "foo") == true, but should return false when the
> two keys are equal.
>
>
> BTW, the following code can reproduce your "bug":
>
> import std.algorithm;
> void main() {
> sort!("a <= b")( [2,1].dup );
> }
I guess that's why I should use return x<y and not return x<=y , btw I didn't know that "<" and the like work with strings.
I actually don't know why it swaps two elements which are equal. I guess it's something advanced.
Thanks for illustrating.
More information about the Digitalmars-d
mailing list