mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
Updated SliceTricks (markdown)
parent
2ed870fe5e
commit
1265d4d8ab
@ -11,6 +11,12 @@ a = append(a, b...)
|
|||||||
```go
|
```go
|
||||||
b = make([]T, len(a))
|
b = make([]T, len(a))
|
||||||
copy(b, a)
|
copy(b, a)
|
||||||
|
|
||||||
|
// These two are often a little slower than the above one,
|
||||||
|
// but they would be more efficient if there are more
|
||||||
|
// elements to be appended to b.
|
||||||
|
b = append([]T(nil), a...)
|
||||||
|
b = append(a[:0:0], a...
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Cut
|
#### Cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user