collections/comparators/numeric.go

11 lines
345 B
Go
Raw Permalink Normal View History

2023-07-26 22:13:21 +02:00
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
}
}