On 06/03/2017 07:41 PM, jmh530 wrote:
On Saturday, 3 June 2017 at 22:18:06 UTC, Timon Gehr wrote:
There is no mistake. (But 'auto' is redundant.)
void main() {
import std.algorithm, std.stdio;
enum a = [ 3, 1, 2, 4, 0 ];
enum b = sort(a);// static is not CT !!!!!
static assert(b[0] == 0); // does not pass with static auto b...
writeln(b);
}
This is worse. Now there is an allocation at runtime.
So maybe we can do a blog post on when to use static or enum? Because
smart people don't seem to be agreeing on this...
Yes please! cc Mike. -- Andrei