delete hash[key] deprecated???

Koroskin Denis 2korden+dmd at gmail.com
Tue Jul 15 14:23:30 PDT 2008


On Tue, 15 Jul 2008 20:40:07 +0400, Leandro Lucarella <llucax at gmail.com>  
wrote:

> Max Samukha, el 15 de julio a las 17:54 me escribiste:
>> >> >>If not, do I have to do:
>> >> >>auto c = hash["x"];
>> >> >>hash.remove["x"];
>> >> >>delete c;
>> >> >
>> >> >Yeah, you do.
>> >>
>> >>
>> >> No I don't.
>> >>
>> >>    delete * cast(Object*) &hash["x"];
>> >
>> >Phew! That's much better! (!) o_O
>>
>> An alternative hack:
>>
>> delete *("x" in hash);
>
> It just gets better and better ;)
>

But you still have to remove a dead pointer from a collection:

delete *("x" in hash);
hash.remove("x");


More information about the Digitalmars-d-learn mailing list