mutable pointers as associative array keys

Steven Schveighoffer schveiguy at gmail.com
Mon Apr 10 20:25:00 UTC 2023


On 4/10/23 2:14 PM, John Colvin wrote:
> It seems that it isn't possible, am I missing something?
> 
> alias Q = int[int*];
> pragma(msg, Q); // int[const(int)*]

Yep, it's been that way forever. Only with pointers and arrays. It's 
fine with mutable classes and structs (even if they contain pointers).

> Also, is this documented somewhere?

No.

It's also completely useless. Having const keys does nothing to 
guarantee unchanging keys. Another half-assed attempt to be encode 
correct semantics but fails completely in its goal.

-Steve


More information about the Digitalmars-d-learn mailing list