Skip to content

Commit

Permalink
docs: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfogre committed Oct 24, 2023
1 parent bb13950 commit 81d4228
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

package pt

// P return pointer of v
// P return pointer of v.
// It's a short form of "Pointer" or "GetPointer".
func P[T any](v T) *T {
return &v
}

// V return value of p
// V return value of p. If p is nil, return zero value of T.
// It's a short form of "Value" or "GetValue".
func V[T any](p *T) T {
if p == nil {
return *new(T)
Expand Down

0 comments on commit 81d4228

Please sign in to comment.