go generics for the busy gopher
Go 1.18 introduces generics to the language
func min(a, b int) int { if a < b { return a } return b }
=>
func min[T constraints.Ordered](a, b T) T { if a < b { return a } return b }
Getting Started with Generics in Go - YouTube
No comments:
Post a Comment