Range length property
Per Nordlöw
per.nordlow at gmail.com
Tue Apr 10 21:43:42 UTC 2018
On Tuesday, 10 April 2018 at 20:16:18 UTC, Steven Schveighoffer
wrote:
> e.g. std.array.array is going to pre-allocate an array of the
> correct length and fill it in, vs. appending each element as it
> gets them from the range.
>
> Personally, I would store the length because typically a
> container range is short-lived. It also jives with the
> container itself which likely has O(1) length.
Thanks, that's what I thought too.
More information about the Digitalmars-d-learn
mailing list