non-constant expression while initializing two dim array
tirithen
tirithen at gmail.com
Mon Jun 8 06:37:18 UTC 2020
How can I initialize my two dimensional array?
When I try to run the code below I get the error:
Error: non-constant expression ["user":[cast(Capability)0],
"administrator":[cast(Capability)1]]
Code:
enum Capability {
self,
administer
}
alias Capabilities = immutable Capability[];
private Capabilities[string] roleCapabilities = [
"user" : [Capability.self], "administrator" :
[Capability.administer]
];
I have tried adding more const and immutable prefixes but it
still gives me the same error. The goal is that roleCapabilities
should be an immutable/const two dimensional array.
More information about the Digitalmars-d-learn
mailing list