The generic zero function now is a bit more comprehensible
parent
10704d946f
commit
35d42b8316
@ -1,5 +1,6 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
func Zero[T any]() T {
|
func Zero[T any]() T {
|
||||||
return *new(T)
|
var zero T
|
||||||
|
return zero
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue