1
0
mirror of https://github.com/golang/go synced 2024-09-28 20:14:28 -06:00
This commit is contained in:
Jes Cok 2023-11-16 00:23:23 +08:00
parent 2860f411c3
commit 48bb3bb05c

View File

@ -127,7 +127,7 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
// The elements at s[i:] are shifted up to make room. // The elements at s[i:] are shifted up to make room.
// In the returned slice r, r[i] == v[0], // In the returned slice r, r[i] == v[0],
// and r[i+len(v)] == value originally at r[i]. // and r[i+len(v)] == value originally at r[i].
// Insert panics if i is out of range, which means i > len(s). // Insert panics if i is out of range.
// This function is O(len(s) + len(v)). // This function is O(len(s) + len(v)).
func Insert[S ~[]E, E any](s S, i int, v ...E) S { func Insert[S ~[]E, E any](s S, i int, v ...E) S {
n := len(s) n := len(s)