aa.keys, synchronized and shared
torhu
torhu at yahoo.com
Fri Nov 11 16:16:09 UTC 2022
On Friday, 11 November 2022 at 14:19:31 UTC, Kagamin wrote:
> Try this:
> ```
> private:
> V[K] sharedTable;
> ref inout(V[K]) unsharedTable() inout
> {
> return *cast(inout(V[K])*)&sharedTable;
> }
> ```
Thanks, that worked! Feels like programming in C, though. If I
could figure out how to initialize the AA explicitly, I could
also remove the ref here. If I just remove the ref, the AA is
always null. If I try to initialize it in the constructor, I get
this:
src\syncaa.d(11,5): Error: `_d_monitorenter` cannot be
interpreted at compile time, because it has no available source
code
No idea why, it seems to happen if I try to use the AA in the
constructor at all. Even when I just do `data_.remove(K.init);`
I also tried DMD 2.101.0-rc.1, using the new `new V[K]` syntax,
same error there.
More information about the Digitalmars-d-learn
mailing list