digitalmars.D.learn - Does reserve() preallocate for futher appends too?
- Jack (3/3) Feb 28 2021 isn't clear for me if reserve() does preallocate memory so that
- Adam D. Ruppe (3/6) Feb 28 2021 Slicing never allocates memory. reserve extends the capacity for
- Jack (2/9) Feb 28 2021 thanks
- bachmeier (3/6) Mar 01 2021 You may potentially find this article of use:
isn't clear for me if reserve() does preallocate memory so that that operator like arr ~= x can use previously allocate memory by reserve() or it's just used in slices like b = arr[x .. y]?
Feb 28 2021
On Monday, 1 March 2021 at 03:07:19 UTC, Jack wrote:isn't clear for me if reserve() does preallocate memory so that that operator like arr ~= x can use previously allocate memory by reserve() or it's just used in slices like b = arr[x .. y]?Slicing never allocates memory. reserve extends the capacity for the ~= operator.
Feb 28 2021
On Monday, 1 March 2021 at 03:12:42 UTC, Adam D. Ruppe wrote:On Monday, 1 March 2021 at 03:07:19 UTC, Jack wrote:thanksisn't clear for me if reserve() does preallocate memory so that that operator like arr ~= x can use previously allocate memory by reserve() or it's just used in slices like b = arr[x .. y]?Slicing never allocates memory. reserve extends the capacity for the ~= operator.
Feb 28 2021
On Monday, 1 March 2021 at 03:07:19 UTC, Jack wrote:isn't clear for me if reserve() does preallocate memory so that that operator like arr ~= x can use previously allocate memory by reserve() or it's just used in slices like b = arr[x .. y]?You may potentially find this article of use: https://dlang.org/articles/d-array-article.html
Mar 01 2021