sort strings by interpreting them as integrals

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Jul 29 19:12:08 PDT 2012


On 7/30/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> How would you implement that? It could be a nice exercise! :)

Here's a super-inefficient way to do it:

auto y = to!(size_t[])(pipe!(map!(y => y[1 .. $]))(x).array);
sort(y);
auto z = map!(y => "_" ~ to!string(y))(y);

Heheh, memory waste galore.


More information about the Digitalmars-d-learn mailing list