Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gptr/gptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func IsNotNil[T any](p *T) bool {
return p != nil
}

// IsNilOrZero returns whether the given pointer p is nil or the value it points to is zero.
func IsNilOrZero[T comparable](p *T) bool {
return p == nil || gvalue.IsZero(*p)
}

// Clone returns a shallow copy of the slice.
// If the given pointer is nil, nil is returned.
//
Expand Down
Loading