cmp

package
v1.6.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal[T comparable](a T, b T) bool

func Greater

func Greater[T constraints.Ordered](a T, b T) bool

func Less

func Less[T constraints.Ordered](a T, b T) bool

Types

type Compare

type Compare[T any] interface {
	Compare(T) int
}

type CompareFunc

type CompareFunc[T any] func(T, T) int

type CompareKey

type CompareKey[T comparable] interface {
	CompareKey() T
}

type GTValue

type GTValue[T constraints.Ordered] struct {
	Value T
}

func (GTValue[T]) Compare

func (a GTValue[T]) Compare(b GTValue[T]) bool

type LTValue

type LTValue[T constraints.Ordered] struct {
	Value T
}

func (LTValue[T]) Compare

func (a LTValue[T]) Compare(b GTValue[T]) bool

type OrderKey added in v1.6.3

type OrderKey[T constraints.Ordered] interface {
	OrderKey() T
}

comparable 只能比较是否相等,不能比较大小

type Sort added in v1.6.3

type Sort[T any] interface {
	Less(T) bool
}

type SortFunc added in v1.6.3

type SortFunc[T any] func(T, T) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL