Bug 9457 – isSorted(string) doesn't work

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-05T17:08:00Z
Last change time
2013-02-13T00:13:52Z
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-02-05T17:08:14Z
This used to print true-false, but in DMD 2.062alpha prints true-true on Windows: import std.stdio, std.algorithm; void main() { auto x = "abcd"; writeln(isSorted(x)); auto y = "acbd"; writeln(isSorted(y)); } Maybe this line: https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L9237 for (; !ahead.empty; ahead.popFront(), ++i) Should be: for (; !ahead.empty; ahead.popFront(), r.popFront(), ++i)
Comment #1 by bearophile_hugs — 2013-02-05T18:10:44Z
A comment from Brad Anderson: > Looks like line 9221 is essentially the same code so you may want > to change that line too.
Comment #2 by bearophile_hugs — 2013-02-06T03:10:17Z
This used to work not too much time ago.
Comment #3 by andrej.mitrovich — 2013-02-12T13:52:58Z
Comment #4 by github-bugzilla — 2013-02-12T14:43:43Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/98cb833137c1c7cb9a51e7acb3cdf43332e0c7ac Fixes Issue 9457 - isSorted(string) does not work. https://github.com/D-Programming-Language/phobos/commit/8bf6997acfdbe81442e4c3e4c3500b9197ffaaca Merge pull request #1136 from AndrejMitrovic/Fix9457 Issue 9457 - isSorted(string) does not work.
Comment #5 by github-bugzilla — 2013-02-13T00:13:52Z