From c6381d40e80b3c8bc08bba70da349e3fe0f198c0 Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 19 Nov 2024 19:24:57 +1300 Subject: [PATCH] genbindings/util: add slice_copy helper --- cmd/genbindings/util.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/genbindings/util.go b/cmd/genbindings/util.go index 5beb03d6..41735380 100644 --- a/cmd/genbindings/util.go +++ b/cmd/genbindings/util.go @@ -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 } \ No newline at end of file