Associative arrays give compile error

bearophile bearophileHUGS at lycos.com
Tue Oct 5 17:14:37 PDT 2010


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


More information about the Digitalmars-d-learn mailing list