13 lines
187 B
Go
13 lines
187 B
Go
|
package util
|
||
|
|
||
|
func RemoveFromSlice[T any](s []T, i int) []T {
|
||
|
s[i] = s[len(s)-1]
|
||
|
return s[:len(s)-1]
|
||
|
}
|
||
|
|
||
|
func SliceSwap[T any](s []T, x, y int) {
|
||
|
tmp := s[x]
|
||
|
s[x] = s[y]
|
||
|
s[y] = tmp
|
||
|
}
|