1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:54:57 -07:00
go/api/next/48000.txt
Joe Tsai 61f0409c31 reflect: add Value.Grow
The Grow method is like the proposed slices.Grow function
in that it ensures that the slice has enough capacity to append
n elements without allocating.

The implementation of Grow is a thin wrapper over runtime.growslice.
This also changes Append and AppendSlice to use growslice under the hood.

Fixes #48000

Change-Id: I992a58584a2ff1448c1c2bc0877fe76073609111
Reviewed-on: https://go-review.googlesource.com/c/go/+/389635
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-15 17:02:11 +00:00

2 lines
45 B
Plaintext

pkg reflect, method (Value) Grow(int) #48000