Change-Id: I8b9aa1f36ce554d8855ee70e15f0dd0a8cf1097a
Reviewed-on: https://go-review.googlesource.com/c/go/+/568342
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
// Clone returns a copy of the slice.
// The elements are copied using assignment, so this is a shallow clone.
+// The result may have additional unused capacity.
func Clone[S ~[]E, E any](s S) S {
// The s[:0:0] preserves nil in case it matters.
return append(s[:0:0], s...)