delete hash[key] deprecated???

Leandro Lucarella llucax at gmail.com
Mon Feb 11 12:28:27 PST 2008


BCS, el 11 de febrero a las 20:23 me escribiste:
> Reply to Leandro,
> 
> >I have this example code:
> >class C { ... }
> >C[string] hash;
> >auto c = new C;
> >hash["x"] = c;
> >// other place
> >delete hash["x"];
> >hash.remove("x");
> >And I got: Error: delete aa[key] deprecated, use aa.remove(key)
> >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? I found that a little odd. If not, do I have to
> >do:
> >auto c = hash["x"];
> >hash.remove["x"];
> >delete c;
> >I find that a little odd too.
> >And yes, I want to explicitly delete the object because I want to
> >minimize the GC activity since my program is kinda RT :)
> 
> you might have luck with "delete (hash["x"]);" but I to lazy to check.

I tried and I failed :(

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Pity's very underrated. I like pity. It's good.
	-- George Constanza


More information about the Digitalmars-d-learn mailing list