Compare commits

...

1 Commits

Author SHA1 Message Date
efc99a9658 Ref implemented 2025-02-04 22:04:55 +01:00

10
to.go
View File

@ -17,6 +17,16 @@ func Deref[T any](s []*T) []T {
return out
}
// Ref returns a slice containing pointers to all values of s.
// The order in s is preserved.
func Ref[T any](s []T) []*T {
out := make([]*T, 0, len(s))
Each(s, func(v T) {
out = append(out, &v)
})
return out
}
// ToList returns a list.List containing all values of s
func ToList[T any](s []T) *list.List {
l := list.New()