sorting a string
Anton Fediushin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 14 12:50:17 PDT 2017
On Friday, 14 July 2017 at 17:23:41 UTC, Steven Schveighoffer
wrote:
> Don't do this, because it's not what you think. It's not
> actually calling std.algorithm.sort, but the builtin array sort
> property. This will be going away soon.
This sucks. I know, that `.sort` will be removed, but I thought
it won't break any code.
> With 2.075, it won't compile even without the parentheses,
> because a char[] is not an array according to std.algorithm...
But why? This should be true for `char[]`, isn't it?
-----
if ((ss == SwapStrategy.unstable && (hasSwappableElements!Range
|| hasAssignableElements!Range) || ss != SwapStrategy.unstable &&
hasAssignableElements!Range) && isRandomAccessRange!Range &&
hasSlicing!Range && hasLength!Range)
-----
(It's from
https://dlang.org/phobos/std_algorithm_sorting.html#sort)
More information about the Digitalmars-d-learn
mailing list