File size: 260 Bytes
fea99b3
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
package cmpx

// Comparable is implemented by values with a deterministic ordering.
type Comparable[T any] interface {
	Compare(T) int
}

// Compare orders two comparable values.
func Compare[T Comparable[T]](left, right T) int {
	return left.Compare(right)
}