Why can't static arrays be sorted?

TheGag96 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 4 13:05:15 PDT 2016


I was writing some code today and ran into this oddity that I'd 
never come across before:

     import std.algorithm : sort;
     int[10] arr = [0, 3, 4, 6, 2, 1, 1, 4, 6, 9];
     thing.sort();

This doesn't compile. Obviously the .sort property works, but 
what about static arrays makes them unable to be sorted by 
std.algorithm.sort? Thanks.


More information about the Digitalmars-d-learn mailing list