genbindings/util: add slice_copy helper

This commit is contained in:
mappu 2024-11-19 19:24:57 +13:00
parent 8d1c871de3
commit c6381d40e8

View File

@ -46,3 +46,11 @@ func slice_to_set[T comparable](list []T) map[T]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
}