blob: ee757c4af6416ff312d4fe622102c4d03f86f8a5 [file] [log] [blame]
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package constraints defines some useful type constraints.
package constraints
// Ordered permits any ordered type: any type that supports
// the operations <, <=, >=, >, as well as == and !=.
type Ordered interface {
type int, int8, int16, int32, int64,
uint, uint8, uint16, uint32, uint64, uintptr,
float32, float64,
string
}
// Integer permits any integer type.
type Integer interface {
type int, int8, int16, int32, int64,
uint, uint8, uint16, uint32, uint64, uintptr
}
// Signed permits any signed integer type.
type Signed interface {
type int, int8, int16, int32, int64
}
// Unsigned permits any unsigned integer type.
type Unsigned interface {
type uint, uint8, uint16, uint32, uint64, uintptr
}