Files
lo/pointers.go
Samuel Berthe 74b7c77702 Initial commit
2022-03-02 13:52:01 +01:00

12 lines
229 B
Go

package lo
// ToPtr returns a pointer copy of value.
func ToPtr[T any](x T) *T {
return &x
}
// ToPtr returns a slice of pointer copy of value.
func ToSlicePtr[T any](collection []T) []*T {
return Map(collection, ToPtr[T])
}