Documentation
¶
Index ¶
- func NewSortByIndex[V any](a []V, iLess func(i, j int) bool) sort.Interface
- func NewSortByValue[V any](a []V, vLess func(a, b V) bool) sort.Interface
- func SortByIndex[V any](a []V, iLess func(i, j int) bool)
- func SortByValue[V any](a []V, vLess func(a, b V) bool)
- func SortIStable[V any](a []V, iLess func(i, j int) bool)
- func SortVStable[V any](a []V, vLess func(a, b V) bool)
- type Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSortByIndex ¶
NewSortByIndex creates a new sort.Interface for sorting by index comparison. NewSortByIndex 根据索引比较函数创建一个新的 sort.Interface。
func NewSortByValue ¶
NewSortByValue creates a new sort.Interface for sorting by value comparison. NewSortByValue 根据值比较函数创建一个新的 sort.Interface。
func SortByIndex ¶
SortByIndex sorts the slice `a` using the index-based comparison function `iLess`. SortByIndex 使用基于索引的比较函数 `iLess` 对切片 `a` 进行排序。
func SortByValue ¶
SortByValue sorts the slice `a` using the value-based comparison function `vLess`. SortByValue 使用基于值的比较函数 `vLess` 对切片 `a` 进行排序。
func SortIStable ¶
SortIStable sorts the slice `a` using the index-based comparison function `iLess` and preserves the original order of equal elements (stable sort). SortIStable 使用基于索引的比较函数 `iLess` 对切片 `a` 进行排序,并保持相等元素的原始顺序(稳定排序)。
func SortVStable ¶
SortVStable sorts the slice `a` using the value-based comparison function `vLess` and preserves the original order of equal elements (stable sort). SortVStable 使用基于值的比较函数 `vLess` 对切片 `a` 进行排序,并保持相等元素的原始顺序(稳定排序)。
Types ¶
type Slice ¶
type Slice[V any] struct { // contains filtered or unexported fields }
Slice represents a slice that can be sorted using either an index-based or value-based comparison function. Slice 结构体表示一个可以使用索引或值比较函数排序的切片。