Static initialization of associative arrays
Chris Piker
chris at hoopjump.com
Thu Mar 11 19:15:54 UTC 2021
On Thursday, 11 March 2021 at 18:41:08 UTC, Ali Çehreli wrote:
> On 3/11/21 10:06 AM, Chris Piker wrote:
>
> > https://dlang.org/spec/hash-map.html#static_initialization
> >
> > that this feature is not yet implemented.
>
> I use a shared static this() block:
>
> immutable string[int] aa;
>
> shared static this() {
> aa = [ 1: "one" ];
> }
>
> Ali
Hi Ali
Always good to hear from an author. I picked up a copy of your
book the other day... nice work!
I appreciate the tips on compile-time execution (hadn't thought
of that), but do you know how I find out about the implementation
status of a feature in D? I'm aware of the DIP system, but I
though DIPs were just for language changes.
Thanks,
More information about the Digitalmars-d-learn
mailing list