3 ms·
I’m not super familiar with Go generics, but would it be able to express the kind of constraints you’d typically want for a heap, namely that the elements are c
by saagarjha 3y ago
I’m not super familiar with Go generics, but would it be able to express the kind of constraints you’d typically want for a heap, namely that the elements are comparable in some way?
- tommiegannert 3y agoFor built-ins, yes: https://pkg.go.dev/cmp@go1.21.4#Ordered https://pkg.go.dev/cmp@go1.21.4#Ordered Custom types would require a custom interface.