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

@ -45,4 +45,12 @@ func slice_to_set[T comparable](list []T) map[T]struct{} {
ret[v] = struct{}{}
}
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
}