On 11/5/14 7:54 AM, Ivan Kazmenko wrote:
Hi!

This gives an error (cannot deduce template function from argument types):

-----
import std.algorithm;
void main () {
     char [] c;
     sort (c);
}
-----

Why is "char []" so special that it can't be sorted?

Because sort works on ranges, and std.range has the view that char[] is a range of dchar without random access. Nevermind what the compiler thinks :)

I believe you can get what you want with std.string.representation:

import std.string;

sort(c.representation);

-Steve

Reply via email to