Bug 13689 – byCodeUnit fails to be a random access range

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-11-05T13:44:00Z
Last change time
2015-02-18T03:39:40Z
Keywords
pull
Assigned to
nobody
Creator
schuetzm

Comments

Comment #0 by schuetzm — 2014-11-05T13:44:04Z
This doesn't compile with Phobos master: import std.algorithm; import std.utf; void main () { char [] c; sort (c.byCodeUnit); } For whatever reasons, it doesn't satisfy `isRandomAccessRange`.
Comment #1 by bearophile_hugs — 2014-11-05T14:21:21Z
This works: void main() { import std.algorithm: sort; import std.string: representation; char[] arr = "ACBA".dup; arr.representation.sort(); assert(arr == "AABC"); }
Comment #2 by hsteoh — 2014-11-05T14:58:30Z
Comment #3 by github-bugzilla — 2014-11-10T20:23:02Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/8898fe5571885a2cd88a940743969f53a0f67925 Issue 13689: byCodeUnit fails to be a random access range. Add static assert to ensure random accessability. https://github.com/D-Programming-Language/phobos/commit/77b4b8ac22d2cb505dcb11fcbcb1e42f35c5881a Merge pull request #2656 from quickfur/issue13689 [trivial] Issue 13689: byCodeUnit fails to be a random access range.
Comment #4 by hsteoh — 2014-11-10T20:36:54Z
Confirmed fixed on git HEAD. Tested on Linux/64.
Comment #5 by github-bugzilla — 2015-02-18T03:39:40Z