std::is_error_code_enum
ja.cppreference.net より
| ヘッダ <system_error>
|
||
template< class T >
struct is_error_code_enum;
|
で定義 (C++11以上) | |
T がエラーコード列挙(std::io_errc や std::future_errc など)の場合、このテンプレートはメンバ定数 value を true として提供します。その他の型の場合、value は false です。
このテンプレートは、プログラム定義型に対して特殊化されることで、その型が std::error_code の暗黙変換に適格であることを示すことができます。
ヘルパー変数テンプレート
|
template
<
class
T
>
constexpr bool is_error_code_enum_v = is_error_code_enum < T > :: value ; |
(C++17以降) | |
std::integral_constantから継承
メンバ定数
|
value
[static]
|
true
Tがエラーコード列挙型の場合、
false
それ以外の場合
(公開静的メンバ定数) |
メンバ関数
|
operator bool
|
オブジェクトを
bool
に変換し、
value
を返す
(公開メンバ関数) |
|
operator()
(C++14)
|
value
を返す
(公開メンバ関数) |
メンバ型
| 型 | 定義 |
value_type
|
bool |
type
|
std:: integral_constant < bool , value > |
このコードを実行
#include <ios> #include <system_error> static_assert(std::is_error_code_enum_v<decltype(std::io_errc::stream)>); static_assert(!std::is_error_code_enum_v<std::error_category>); int main() {}
関連項目
|
(C++11)
|
列挙型が
std::error_condition
であることを識別する
(クラステンプレート) |