non-constant expression ["foo":5, "bar":10, "baz":2000]
HuskyNator
HuskyNator at protonmail.ch
Thu Jan 6 16:01:40 UTC 2022
On Thursday, 6 January 2022 at 13:33:24 UTC, bauss wrote:
> While not the exact same, there's a small work around here that
> can help in some cases:
>
> ```d
> immutable long[string] aa;
> shared static this() {
> aa = [
> "foo": 5,
> "bar": 10,
> "baz": 2000
> ];
> }
> ```
Thanks a lot!
I've tried it with static this() earlier, but the shared part
fixes it for me.
More information about the Digitalmars-d-learn
mailing list