AA with immutable values
Roman D. Boiko
rb at d-coding.com
Sun Jun 24 04:57:44 PDT 2012
immutable(SomeClass)[S] _map;
_map[S.init] = null; // doesn't compile since _map[S.init] is
immutable
My current workaround is:
immutable(SomeClass)*[S] _map;
_map[S.init] = [null].ptr;
But this introduces an additional level of indirection in a
performance-critical part of my code.
Probably I could cast away immutable before storing, and cast
back to immutable after retrieving. But I would be more happy
without these two casts. (By the way, is it correct that this way
would be more efficient?)
Is there any other way to put immutable values into a dictionary?
More information about the Digitalmars-d-learn
mailing list