This commit is contained in:
withchao 2023-02-02 18:45:43 +08:00
parent b7f0e2e6f3
commit dec0c8cc47

View File

@ -261,6 +261,14 @@ func SortAny[E any](es []E, fn func(a, b E) bool) {
})
}
// If true -> a, false -> b
func If[T any](isa bool, a, b T) T {
if isa {
return a
}
return b
}
type sortSlice[E any] struct {
ts []E
fn func(a, b E) bool