std::numeric_limits<T>::is_exact
来自 cppreference.cn
< cpp | types | numeric limits
static const bool is_exact; |
(直到 C++11) | |
static constexpr bool is_exact; |
(自 C++11 起) | |
std::numeric_limits<T>::is_exact 的值对于所有使用精确表示的算术类型 T
为 true。
[编辑] 标准特化
T
|
std::numeric_limits<T>::is_exact 的值 |
/* 非特化 */ | false |
bool | true |
char | true |
signed char | true |
unsigned char | true |
wchar_t | true |
char8_t (自 C++20 起) | true |
char16_t (自 C++11 起) | true |
char32_t (自 C++11 起) | true |
short | true |
unsigned short | true |
int | true |
unsigned int | true |
long | true |
unsigned long | true |
long long (自 C++11 起) | true |
unsigned long long (自 C++11 起) | true |
float | false |
double | false |
long double | false |
[编辑] 注释
虽然所有 std::numeric_limits<T>::is_exact == true 的基本类型 T
都是整数类型,但库可以定义不是整数的精确类型,例如表示分数的有理算术类型。
[编辑] 参见
[静态] |
标识整数类型 (公共静态成员常量) |
[静态] |
标识有符号类型 (公共静态成员常量) |
[静态] |
标识表示有限值集的类型 (公共静态成员常量) |