12345678910111213141516171819202122 |
- package types
- // The pointer type that will never panic
- // and that forces you to check if it is
- // valid.
- /*type SafePtr[V any] struct {
- ptr *V
- }
- func NewSafePtr[V any]() SafePtr[V] {
- return
- }
- func (ptr SafePtr[V]) GotV() (V, bool) {
- var buf [1]V
- if ptr.ptr == nil {
- return buf[0], false
- }
- return *ptr.ptr, true
- }*/
|