Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 739 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 739 Bytes

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)