www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Re: delete hash[key] deprecated???

Simen Kjaeraas wrote:
 JAnderson wrote:
 Max Samukha wrote:
 On Wed, 16 Jul 2008 01:23:30 +0400,



 <2korden+dmd gmail.com> wrote:

 But you still have to remove a dead




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

If 'remove' was modified to return the



 syntax would be possible:

 delete hash.remove("x");

 Also, there would be no need to search for the



 introduce a temporary when the removed value



 processing:

 // do something with the value, for example,



 foo(hash.remove("x"));

 instead of:
 auto v = hash["x"];
 hash.remove("x");
 foo(v);


Seconded! Regan Heath

Thirded!

I'm always interested in using more compact and more general versions of functions, rather than having to take more steps, so Fourthed!
Jul 19 2008