AA and struct with const member

frame frame86 at live.com
Mon Dec 27 19:38:38 UTC 2021


I feel stupid right now: One cannot assign a struct that contains 
const member to AA?

Error: cannot modify struct instance ... of type ... because it 
contains `const` or `immutable` members

This is considered a modification?
```d
struct S
{
   const(int) a;
}

S[string] test;
test["a"] = S(1);
```

Whats the workaround for that?


More information about the Digitalmars-d-learn mailing list