Skip to content
/ ptr Public

convert between value and pointer with generics

License

Notifications You must be signed in to change notification settings

koron-go/ptr

Repository files navigation

koron-go/ptr

PkgGoDev Actions/Go Go Report Card

Package ptr provides convert functions between value and pointer with using generics.

Usage

Import github.com/koron-go/ptr.

Get a pointer of a value.

ptr.P(123)   // (*int)
ptr.P("foo") // (*string)

Get a value which referenced by a pointer.

n := 123
ptr.V(&n) // 123 (int)

s := "abc"
ptr.V(&s) // "abc" (string)

About

convert between value and pointer with generics

Resources

License

Stars

Watchers

Forks

Packages

No packages published