Cast converts AA to rvalue?

ag0aep6g anonymous at example.com
Wed Aug 10 09:52:10 UTC 2022


On 10.08.22 10:20, Johan wrote:
> ```
> shared immutable int[int] aa;
> void main () {
>      // (cast()aa)[1] = 1; // works without immutable
>      (*cast(int[int]*)(&aa))[1] = 1;
> }
> ```

We have shared static constructors for that:

shared static this()
{
     aa[1] = 1; /* no cast needed */
}


More information about the Digitalmars-d-learn mailing list