mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/util: add slice_copy helper
This commit is contained in:
parent
8d1c871de3
commit
c6381d40e8
@ -45,4 +45,12 @@ func slice_to_set[T comparable](list []T) map[T]struct{} {
|
|||||||
ret[v] = struct{}{}
|
ret[v] = struct{}{}
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func slice_copy[T comparable](input []T) []T {
|
||||||
|
ret := make([]T, len(input))
|
||||||
|
for i, elem := range input {
|
||||||
|
ret[i] = elem
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user