mirror of https://github.com/golang/go.git
add comment // bounds check
This commit is contained in:
parent
d50cae90e1
commit
1bbec230f4
|
|
@ -130,7 +130,7 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
|
||||||
// Insert panics if i is out of range.
|
// 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 {
|
||||||
_ = s[i:]
|
_ = s[i:] // bounds check
|
||||||
|
|
||||||
m := len(v)
|
m := len(v)
|
||||||
if m == 0 {
|
if m == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue