diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2022-03-02 13:01:48 -0800 |
|---|---|---|
| committer | Joseph Tsai <joetsai@digital-static.net> | 2022-10-15 17:02:11 +0000 |
| commit | 61f0409c31cad8729d7982425d353d7b2ea80534 (patch) | |
| tree | 017883773a9694862745945370b7ff6630526d9e /api | |
| parent | 9ddb8ea73724d717a9bbf44be7d585ba5587504f (diff) | |
| download | go-61f0409c31cad8729d7982425d353d7b2ea80534.tar.xz | |
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>
Diffstat (limited to 'api')
| -rw-r--r-- | api/next/48000.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/api/next/48000.txt b/api/next/48000.txt new file mode 100644 index 0000000000..4b92ab68fb --- /dev/null +++ b/api/next/48000.txt @@ -0,0 +1 @@ +pkg reflect, method (Value) Grow(int) #48000 |
