On Saturday, 3 June 2017 at 18:31:37 UTC, Russel Winder wrote:
On Sat, 2017-06-03 at 13:32 -0400, Andrei Alexandrescu via
Digitalmars- d wrote:
[…]
There is nothing to do really. Just use standard library sort.
void main() {
import std.algorithm, std.stdio;
enum a = [ 3, 1, 2, 4, 0 ];
static auto b = sort(a);
writeln(b);
}
But is this sort guaranteed to happen at compile time rather
than runtime?
Yes: https://dlang.org/spec/function.html#interpretation
And there's no jumping through ridiculous hoops, unlike the
article.