Documentation ¶
Index ¶
- func LessFuncOrdered[T constraints.Ordered](ordering SortOrder) func(T, T) bool
- func MaxValuer[T constraints.Ordered](values []Getter[T]) T
- func MergeSort[T constraints.Ordered](arr []T, ordering SortOrder) []T
- func MergeSortCmp[T CmpOrdered[T]](arr []T, ordering SortOrder) []T
- func MergeSortedArrays[T any](a []T, b []T, lessFunc func(a T, b T) bool) []T
- func MinValuer[T constraints.Ordered](values []Getter[T]) T
- func QuickSort[T constraints.Ordered](arr []T, ordering SortOrder) []T
- func QuickSortCmp[T CmpOrdered[T]](arr []T, ordering SortOrder) []T
- func ToValues[T any](getters []Getter[T]) []T
- type CmpOrdered
- type Getter
- type LessFunc
- type Set
- type Setter
- type SortOrder
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LessFuncOrdered ¶
func LessFuncOrdered[T constraints.Ordered](ordering SortOrder) func(T, T) bool
LessFuncOrdered selects the appropriate comparison function to check if the elements are ordered. If the returned function returns true, then the elements are sorted according to its |ordering|
func MaxValuer ¶
func MaxValuer[T constraints.Ordered](values []Getter[T]) T
func MergeSort ¶
func MergeSort[T constraints.Ordered](arr []T, ordering SortOrder) []T
func MergeSortCmp ¶
func MergeSortCmp[T CmpOrdered[T]](arr []T, ordering SortOrder) []T
func MergeSortedArrays ¶
func MinValuer ¶
func MinValuer[T constraints.Ordered](values []Getter[T]) T
func QuickSort ¶
func QuickSort[T constraints.Ordered](arr []T, ordering SortOrder) []T
func QuickSortCmp ¶
func QuickSortCmp[T CmpOrdered[T]](arr []T, ordering SortOrder) []T
Types ¶
type CmpOrdered ¶
CmpOrdered represents any type T with `Cmp(T) int` method. Examples of types that implement this interface include *big.Int and *big.Float.
type LessFunc ¶
func FactoryLessFuncCmp ¶
func FactoryLessFuncCmp[T CmpOrdered[T]]( order SortOrder, ) LessFunc[Getter[T]]
func FactoryLessFuncOrdered ¶
func FactoryLessFuncOrdered[T constraints.Ordered]( order SortOrder, ) LessFunc[Getter[T]]
Less implementation for constraints.Ordered
type Set ¶
type Set[T comparable] interface { HasDuplicate(x T) bool }
Click to show internal directories.
Click to hide internal directories.