mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Clarify Expand and Extend
parent
bcffc396a0
commit
46d01ae2a1
@ -67,13 +67,15 @@ a = a[:len(a)-1]
|
||||
```
|
||||
|
||||
#### Expand
|
||||
Insert `n` elements at position `i`:
|
||||
```go
|
||||
a = append(a[:i], append(make([]T, j), a[i:]...)...)
|
||||
a = append(a[:i], append(make([]T, n), a[i:]...)...)
|
||||
```
|
||||
|
||||
#### Extend
|
||||
Append `n` elements:
|
||||
```go
|
||||
a = append(a, make([]T, j)...)
|
||||
a = append(a, make([]T, n)...)
|
||||
```
|
||||
|
||||
#### Filter (in place)
|
||||
|
Loading…
x
Reference in New Issue
Block a user