std:: is_error_code_enum
From cppreference.net
<
cpp
|
error
|
error code
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::error_code
| Member functions | ||||
| Modifiers | ||||
| Observers | ||||
| Non-member functions | ||||
|
(until C++20)
(until C++20)
(C++20)
|
||||
| Helper classes | ||||
|
is_error_code_enum
|
||||
|
定义于头文件
<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]
|
若
T
为错误代码枚举类型则为
true
,否则为
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
(类模板) |