Why std.algorithm.sort can't be applied to char[]?
hane via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 13 01:43:02 PDT 2014
On Monday, 12 May 2014 at 14:56:46 UTC, John Colvin wrote:
> char[] is a rather special type of array: the language has
> unicode support and iterates over it by code-point (i.e. not
> guaranteed to be a single char per iteration).
>
> If you want to sort chars and are assuming ASCII, you can just
> use std.string.representation to work with them as integer
> types:
On Monday, 12 May 2014 at 16:30:12 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
> All strings in D are treated as ranges of dchar, not their
> element type. This
> has to with the fact that a char or wchar are only part of a
> character. If you
> want to sort arrays of characters, you need to use dchar[].
I understand the reason. Thanks!
More information about the Digitalmars-d-learn
mailing list