So how do you create an associative array with an immutable value, anyways?

FeepingCreature feepingcreature at gmail.com
Fri Oct 7 19:20:56 UTC 2022


On Friday, 7 October 2022 at 18:00:56 UTC, Steven Schveighoffer 
wrote:
> `copyEmplace` appears to work:
>
> ```d
> import core.lifetime;
> immutable struct S
> {
>     int x;
> }
> void main()
> {
>     S s = S(5);
>     ubyte[S.sizeof] buf;
>     copyEmplace(s, *cast(S*)buf.ptr);
> }
> ```
>
> -Steve

Yeah, if I could get the associative array to give me a pointer 
to an uninitialized value for a key, that would do it, I think.


More information about the Digitalmars-d mailing list