delete hash[key] deprecated???

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Feb 11 05:50:52 PST 2008


"Leandro Lucarella" <llucax at gmail.com> wrote in message 
news:20080211130722.GA18729 at burns.springfield.home...

> And I got: Error: delete aa[key] deprecated, use aa.remove(key)

As the error suggests, the first syntax was used before the second was 
introduced.  The funny thing is, the 'remove' syntax was partially 
introduced to allow exactly what you're trying to do.  X(

> I don't want to remove the element of the array, I want to destroy the
> object stored at key "x". Does hash.remove("x") remove the item from the
> hash *and* delete c?

No.

> If not, do I have to do:
> auto c = hash["x"];
> hash.remove["x"];
> delete c;

Yeah, you do. 




More information about the Digitalmars-d-learn mailing list