std::numeric_limits<T>::is_specialized
ja.cppreference.net より
static const bool is_specialized;
|
(C++11 まで) | |
static constexpr bool is_specialized;
|
(C++11 以降) | |
std::numeric_limits<T>::is_specialized の値は、 true の特殊化が存在するすべての T に対して std::numeric_limits です。
標準特殊化
T
|
std:: numeric_limits < T > :: is_specialized の値 |
| /* non-specialized */ | 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 | true |
| double | true |
| long double | true |
例
このコードを実行
#include <iostream> #include <limits> #include <type_traits> int main() { enum E{}; std::cout << std::boolalpha << std::numeric_limits<bool>::is_specialized << '\n' << std::numeric_limits<long long>::is_specialized << '\n' << std::numeric_limits<std::true_type>::is_specialized << '\n' << std::numeric_limits<E>::is_specialized << '\n'; }
出力例:
true true false false
関連項目
|
[static]
|
整数型を識別する
(public static member constant) |
|
[static]
|
IEC 559/IEEE 754 浮動小数点型を識別する
(public static member constant) |
|
[static]
|
正確な型を識別する
(public static member constant) |
|
[static]
|
有限の値の集合を表す型を識別する
(public static member constant) |