diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
| commit | 23ecef83b28e9b51187fe34032e9558cf0eb5e05 (patch) | |
| tree | c55d54dd209509e376a4965782b9161243c1fd7d /go/utils | |
| parent | bd558df11dbe60c0bd310b95b26bf17ba06cab35 (diff) | |
| download | muhqs-game-rework-targets.tar.gz muhqs-game-rework-targets.zip | |
intermediate commitrework-targets
Diffstat (limited to 'go/utils')
| -rw-r--r-- | go/utils/slices.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/go/utils/slices.go b/go/utils/slices.go index d2bc04c1..3cc38c1c 100644 --- a/go/utils/slices.go +++ b/go/utils/slices.go @@ -7,3 +7,11 @@ func TypedSliceToInterfaceSlice[T any](s []T) []interface{} { } return is } + +func InterfaceSliceToTypedSlice[T any](s []interface{}) []T { + ts := make([]T, 0, len(s)) + for _, t := range s { + ts = append(ts, t.(T)) + } + return ts +} |
