sort(charArray) doesn't work

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 13 10:21:41 PST 2013


On Wednesday, November 13, 2013 11:58:01 bearophile wrote:
> Uplink_Coder:
> > sort doesn't work on an primitive Array ?
> > Is that normal ....
> > please look @http://www.dpaste.dzfl.pl/961286e1
> > because I don't know what i'm doing worng
> > 
> > Thanks in Advance :D
> 
> One way to solve your char[]:
> 
> return cast(typeof(vars))vars.representation.sort().release;

And why not just return the original and avoid the cast? sort sorts in place. 
e.g.

sort(vars.representation());
return vars;

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list