Construct D Arrray with explicit capacity
arturg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 30 11:26:54 PDT 2016
On Sunday, 30 October 2016 at 18:10:09 UTC, Nordlöw wrote:
> Is there a recommended way to create a builtin D array with a
> given capacity?
>
> I'm aware of the `.capacity` property.
>
> Is it ok to mutate it?
you cant mutate capacity directly because its only a getter but
you could use arr.reserve(someVal);
More information about the Digitalmars-d-learn
mailing list