-
Notifications
You must be signed in to change notification settings - Fork 6
/
copy.go
134 lines (115 loc) · 4.86 KB
/
copy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package slice
// CopyBool creates a copy of a bool slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyBool(a []bool) []bool {
return append(a[:0:0], a...)
}
// CopyByte creates a copy of a byte slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyByte(a []byte) []byte {
return append(a[:0:0], a...)
}
// CopyComplex128 creates a copy of a complex128 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyComplex128(a []complex128) []complex128 {
return append(a[:0:0], a...)
}
// CopyComplex64 creates a copy of a complex64 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyComplex64(a []complex64) []complex64 {
return append(a[:0:0], a...)
}
// CopyFloat32 creates a copy of a float32 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyFloat32(a []float32) []float32 {
return append(a[:0:0], a...)
}
// CopyFloat64 creates a copy of a float64 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyFloat64(a []float64) []float64 {
return append(a[:0:0], a...)
}
// CopyInt creates a copy of an int slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyInt(a []int) []int {
return append(a[:0:0], a...)
}
// CopyInt16 creates a copy of an int16 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyInt16(a []int16) []int16 {
return append(a[:0:0], a...)
}
// CopyInt32 creates a copy of an int32 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyInt32(a []int32) []int32 {
return append(a[:0:0], a...)
}
// CopyInt64 creates a copy of an int64 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyInt64(a []int64) []int64 {
return append(a[:0:0], a...)
}
// CopyInt8 creates a copy of an int8 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyInt8(a []int8) []int8 {
return append(a[:0:0], a...)
}
// CopyRune creates a copy of a rune slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyRune(a []rune) []rune {
return append(a[:0:0], a...)
}
// CopyString creates a copy of a string slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyString(a []string) []string {
return append(a[:0:0], a...)
}
// CopyUint creates a copy of a uint slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUint(a []uint) []uint {
return append(a[:0:0], a...)
}
// CopyUint16 creates a copy of a uint16 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUint16(a []uint16) []uint16 {
return append(a[:0:0], a...)
}
// CopyUint32 creates a copy of a uint32 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUint32(a []uint32) []uint32 {
return append(a[:0:0], a...)
}
// CopyUint64 creates a copy of a uint64 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUint64(a []uint64) []uint64 {
return append(a[:0:0], a...)
}
// CopyUint8 creates a copy of a uint8 slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUint8(a []uint8) []uint8 {
return append(a[:0:0], a...)
}
// CopyUintptr creates a copy of a uintptr slice.
// The resulting slice has the same elements as the original but the underlying array is different.
// See https://github.com/go101/go101/wiki
func CopyUintptr(a []uintptr) []uintptr {
return append(a[:0:0], a...)
}