Meaning of .clear() for containers
Jesse Phillips
jessekphillips+D at gmail.com
Wed Jan 5 07:28:33 PST 2011
Steven Schveighoffer Wrote:
> > Then the answer I gave was wrong, and am curious what the correct answer
> > is:
> >
> > "Delete is not to be used with D version 2 and intended to be removed
> > from the language. What the hold up is, I am not sure. Instead you use a
> > function, I believe clear(), which resets your object to and empty state
> > (frees resources that isn't GC memory). This is explained in The D
> > Programming Language book, which I don't have handy right now."
>
> That answer looks fine to me.
>
> -Steve
K, pulled the book out. What I missed is that clear(object) calls the destructor which is the function that frees the resources.
More information about the Digitalmars-d
mailing list