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`.
This works: void main() { import std.algorithm: sort; import std.string: representation; char[] arr = "ACBA".dup; arr.representation.sort(); assert(arr == "AABC"); }
https://github.com/D-Programming-Language/phobos/pull/2656
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.
Confirmed fixed on git HEAD. Tested on Linux/64.
Commits pushed to 2.067 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. https://github.com/D-Programming-Language/phobos/commit/77b4b8ac22d2cb505dcb11fcbcb1e42f35c5881a Merge pull request #2656 from quickfur/issue13689