mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
16 lines
155 B
Go
16 lines
155 B
Go
package pointer
|
|
|
|
func Pointer[T any](v T) *T {
|
|
return &v
|
|
}
|
|
|
|
func Dereference[T any](v *T) T {
|
|
if v == nil {
|
|
var zero T
|
|
|
|
return zero
|
|
}
|
|
|
|
return *v
|
|
}
|