cannot sort an array of char

Ivan Kazmenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 5 04:54:01 PST 2014


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?

For example, if I know the array contains only ASCII characters, 
sorting it sounds no different to sorting an "int []".

Ivan Kazmenko.


More information about the Digitalmars-d-learn mailing list