You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
202 B

package genutils
import "sort"
type Lesser[T any] interface {
Less(T) bool
}
func SortSlice[T Lesser[T]](slice []T) {
sort.Slice(slice, func(i, j int) bool {
return slice[i].Less(slice[j])
})
}