Why std.algorithm.sort can't be applied to char[]?
hane via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 12 07:49:52 PDT 2014
and is there any way to sort char array with algorithm.sort?
---
import std.algorithm;
import std.range;
void main()
{
int[] arr = [5, 3, 7];
sort(arr); // OK
char[] arr2 = ['z', 'g', 'c'];
sort(arr2); // error
sort!q{ a[0] > b[0] }(zip(arr, arr2)); // error
}
---
I don't know what's difference between int[] and char[] in D, but
it's very unnatural.
More information about the Digitalmars-d-learn
mailing list