AA with immutable values

Roman D. Boiko rb at d-coding.com
Sun Jun 24 05:24:48 PDT 2012


On Sunday, 24 June 2012 at 12:21:50 UTC, Jonathan M Davis wrote:
> On Sunday, June 24, 2012 05:15:03 Ali Çehreli wrote:
>> Although it sounds like a limitation, it may be due to the 
>> fact that AA
>> may need to rehash, which may not be suitable with immutable 
>> values.
>
> const and immutable types as elements of a container are 
> problematic in
> general. The container generally needs to have been designed 
> with them in mind
> for them to work properly - especially in D, where const and 
> immutable are
> very strict, and you're not supposed to be mutating them even 
> through casts.
>
> - Jonathan M Davis

Yeah, but I wonder that such a core feature as AA doesn't support 
this use case better (I mean more efficiently).


More information about the Digitalmars-d-learn mailing list