How i can clear Associative Arrays

gedaiu szabobogdan at yahoo.com
Sat Apr 13 02:54:55 PDT 2013


On Saturday, 13 April 2013 at 09:52:45 UTC, Andrej Mitrovic wrote:
> On 4/13/13, gedaiu <szabobogdan at yahoo.com> wrote:
>> looks great, but i cleared the array like this:
>>
>> values = null;
>
> That's not clearing the array, that's clearing the reference to 
> the
> array. For example:
>
> void main()
> {
>     int[int] hash;
>     hash[1] = 1;
>
>     auto hash2 = hash;  // new reference
>     hash = null;  // clear the reference
>
>     assert(1 in hash2);  // hash still exists
> }

I know, that's why I am asking how i should do this...



More information about the Digitalmars-d-learn mailing list