isle/go/toolkit/toolkit.go

18 lines
399 B
Go

// Package toolkit contains useful utilities which are not specific to any
// specific part of isle.
package toolkit
import "reflect"
// IsZero returns true if the value is equal to its zero value according to
// reflect.DeepEqual.
func IsZero[T any](v T) bool {
var zero T
return reflect.DeepEqual(v, zero)
}
// Ptr returns a pointer to the given value.
func Ptr[T any](v T) *T {
return &v
}