C++17 cannot beat D surely

Meta via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 3 11:44:28 PDT 2017


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.


More information about the Digitalmars-d mailing list