complete initialization of the static allocated array
bearophile
bearophileHUGS at lycos.com
Sun Aug 12 05:29:14 PDT 2012
> There are many ways, like (untested):
>
> AA.keys.sort().equals([EnumMembers!MyEnum].sort())
Seems to work:
import std.algorithm, std.traits;
enum Foo { one, three, seven};
static int[Foo] myMap;
static this() {
with (Foo)
myMap = [
one: 1,
three: 3,
seven: 7
];
assert(myMap.keys.sort().equal([EnumMembers!Foo].sort()));
}
void main() {}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list