Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

GoDev

ptr contains functions for simplified creation of pointers from constants of basic types.

Examples

Getting pointer

This code:

p := ptr.Of(10)

is the equivalent for:

i := int(10) p := &i 

Getting value

p := ptr.Of(10) v := ptr.Value(ptr.Of(10)) // This code returns 10. p = nil v = ptr.Value(p) // This code returns the default value 0. v = ptr.ValueDef(p, 100) // This code returns default value 100.

Documentation

GoDoc

License

Apache 2.0