Thread overview |
---|
October 30, 2016 Construct D Arrray with explicit capacity | ||||
---|---|---|---|---|
| ||||
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? |
October 30, 2016 Re: Construct D Arrray with explicit capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Sunday, 30 October 2016 at 18:10:09 UTC, Nordlöw wrote:
> Is it ok to mutate it?
I just checked. It is not.
|
October 30, 2016 Re: Construct D Arrray with explicit capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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);
|
October 30, 2016 Re: Construct D Arrray with explicit capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to arturg | On Sunday, 30 October 2016 at 18:26:54 UTC, arturg wrote:
> you cant mutate capacity directly because its only a getter but you could use arr.reserve(someVal);
Thx!
|
Copyright © 1999-2021 by the D Language Foundation