Initial commit
This commit is contained in:
23
internal/util/sort.go
Normal file
23
internal/util/sort.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package util
|
||||
|
||||
import "sort"
|
||||
|
||||
type SortFunc struct {
|
||||
Lenf func() int
|
||||
Lessf func(i, j int) bool
|
||||
Swapf func(i, j int)
|
||||
}
|
||||
|
||||
var _ sort.Interface = SortFunc{}
|
||||
|
||||
func (s SortFunc) Len() int {
|
||||
return s.Lenf()
|
||||
}
|
||||
|
||||
func (s SortFunc) Less(i, j int) bool {
|
||||
return s.Lessf(i, j)
|
||||
}
|
||||
|
||||
func (s SortFunc) Swap(i, j int) {
|
||||
s.Swapf(i, j)
|
||||
}
|
||||
Reference in New Issue
Block a user