mutable pointers as associative array keys

JG jg at jg.com
Mon Apr 10 18:45:35 UTC 2023


On Monday, 10 April 2023 at 18:14:56 UTC, John Colvin wrote:
> It seems that it isn't possible, am I missing something?
>
> alias Q = int[int*];
> pragma(msg, Q); // int[const(int)*]
>
> Also, is this documented somewhere?

It seems to be so (which is strange) and I can't image it is by 
design since you
can do this:

     ```d
         static struct Pointer(T) { T* val; }
         int[Pointer!int] f;
         pragma(msg,typeof(f));
         int* val = new int;
         *val = 5;
         f[Pointer!int(val)] = 12;
         *val = 6;
         f[Pointer!int(val)].writeln;  //12
     ```



More information about the Digitalmars-d-learn mailing list