cmp

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T constraints.Ordered](x, y T) int

func Equal

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

func FloatFlip

func FloatFlip[T constraints.Float](i T) T

func Greater

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

func Less

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

func SignedFlip

func SignedFlip[T constraints.Signed](i T) T

func UnSignedFlip

func UnSignedFlip[T constraints.Unsigned](i T) T

Types

type Comparable

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

type ComparableIdx

type ComparableIdx interface {
	Compare(i, j int) int
}

type CompareEqual added in v1.3.20

type CompareEqual[T any] interface {
	Equal(T) bool
}

type CompareFunc

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

func (CompareFunc[T]) LessFunc

func (c CompareFunc[T]) LessFunc() LessFunc[T]

type CompareIdxLess deprecated

type CompareIdxLess interface {
	Less(i, j int) bool
}

Deprecated: use cmp.Comparable

type CompareKey

type CompareKey[T cmp.Ordered] interface {
	CompareKey() T
}

type CompareLess deprecated

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

Deprecated: use cmp.Comparable

type EqualFunc added in v1.3.20

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

type EqualKey

type EqualKey[T comparable] interface {
	EqualKey() 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 LessFunc

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

Jump to

Keyboard shortcuts

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