Associative arrays give compile error

Denis Koroskin 2korden at gmail.com
Tue Oct 5 17:23:12 PDT 2010


On Wed, 06 Oct 2010 04:14:37 +0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Denis Koroskin:
>
>> I found the following to work fine:
>>
>> K[V] assocArray = createAssocArray();
>>
>> K[V] createAssocArray()
>> {
>>      K[V] assocArray = [
>>         k1: v1,
>>         k2: v2,
>>         ...
>>      ];
>>
>>      return assocArray;
>> }
>
> Thank you for your answer. But I need to compute it, so I don't have  
> just an AA literal. And I'd like it to be immutable :-)
>
> Bye,
> bearophile

Compute mutable copy and then cast to immutable. Am I missing something?


More information about the Digitalmars-d-learn mailing list