collections/comparators/numeric.go

11 lines
346 B
Go
Raw Permalink Normal View History

2023-07-26 22:13:21 +02:00
package comparators
import "pkg.icikowski.pl/collections/functions"
2024-05-28 01:28:25 +02:00
// CompareNumeric returns comparator for numeric values.
2023-07-26 22:13:21 +02:00
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
}
}