| // 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 |
| } |