collections/comparators/numeric.go

11 lines
346 B
Go

package comparators
import "pkg.icikowski.pl/collections/functions"
// CompareNumeric returns comparator for numeric values.
func CompareNumeric[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64]() functions.Comparator[T] {
return func(a, b T) bool {
return a < b
}
}