[phobos] Array preallocate function
schveiguy at yahoo.com
Tue Feb 23 10:47:56 PST 2010
I understand your objections to minimize. I don't really have a preference, but I don't really like shrinkToFit. I'll use that for now, since it's probably easy to search/replace later.
----- Original Message ----
> From: Andrei Alexandrescu <andrei at erdani.com>
> > What about a "minimize" function, which simply truncates any
> > "allocated" length after an array. So you would reset an array via:
> > arr.length = 0; arr.minimize();
> > The advantage here is the array's length is not affected, just the
> > allocated length is reduced to match the array's length. There are
> > less invalid cases to worry about (i.e. "shrinking" to something
> > larger doesn't make any sense).
> Sounds good. I'd choose a more specific name, e.g. shrinkToFit. Minimize has me
> think of optimization functions.
> phobos mailing list
> phobos at puremagic.com
More information about the phobos