How i can clear Associative Arrays

Marco Leise Marco.Leise at gmx.de
Sun Apr 28 12:32:40 PDT 2013


Am Mon, 15 Apr 2013 13:06:01 -0400
schrieb "Steven Schveighoffer" <schveiguy at yahoo.com>:

> On Sun, 14 Apr 2013 02:50:07 -0400, gedaiu <szabobogdan at yahoo.com> wrote:
> 
> > On Saturday, 13 April 2013 at 21:10:16 UTC, Nicolas Guillemot wrote:
> >>> I think we should introduce a removeAll function for hashes. Either
> >>> through Druntime or through a UFCS function that we could put in
> >>> std.array or somewhere.
> >>
> >> How about .clear() for consistency with C++ containers?
> >
> > It looks nice... i am waiting for it :P
> 
> Might be confusing.  clear used to do what destroy does now and is still  
> in TDPL.
> 
> -Steve

Right, but the reason clear was renamed to destroy in the
first place was to remove this ambiguity. When I was new to D
I used clear() on AAs ignorant to the fact that it is not
meant to clear containers as in other languages.
Despite the issue with TDPL I'm looking forward to clear() as
a container method.

-- 
Marco



More information about the Digitalmars-d-learn mailing list