Difference between revisions of "cpp/error/error condition/is error condition enum"
From cppreference.com
< cpp | error | error condition
(tweak) |
(Links to the definition of “program-defined type”.) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
{{cpp/error/error_condition/navbar}} | {{cpp/error/error_condition/navbar}} | ||
{{dcl begin}} | {{dcl begin}} | ||
− | {{dcl header | system_error}} | + | {{dcl header|system_error}} |
− | {{dcl | since=c++11 | | + | {{dcl|since=c++11| |
template< class T > | template< class T > | ||
struct is_error_condition_enum; | struct is_error_condition_enum; | ||
Line 9: | Line 9: | ||
{{dcl end}} | {{dcl end}} | ||
− | If {{tt|T}} is an error condition enum, this template provides the member constant {{ | + | If {{tt|T}} is an error condition enum (such as {{lc|std::errc}}), this template provides the member constant {{tt|value}} equal {{c|true}}. For any other type, {{tt|value}} is {{c|false}}. |
− | This template may be specialized for a | + | This template may be specialized for a {{lsd|cpp/language/type#Program-defined type}} to indicate that the type is eligible for {{lc|std::error_condition}} implicit conversions. |
− | + | ===Helper variable template=== | |
− | + | {{ddcl|since=c++17|1= | |
− | === Helper variable template === | + | |
− | {{ddcl | since=c++17 | 1= | + | |
template< class T > | template< class T > | ||
− | constexpr bool is_error_condition_enum_v = is_error_condition_enum<T>::value; | + | inline constexpr bool is_error_condition_enum_v = |
+ | is_error_condition_enum<T>::value; | ||
}} | }} | ||
− | {{cpp/types/integral_constant/inherit | {{tt|T}} is an error condition enum}} | + | {{cpp/types/integral_constant/inherit|{{tt|T}} is an error condition enum}} |
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/error/error_code/dsc is_error_code_enum | + | {{dsc inc|cpp/error/error_code/dsc is_error_code_enum}} |
− | + | ||
{{dsc end}} | {{dsc end}} | ||
+ | |||
+ | {{langlinks|es|ja|ru|zh}} |
Latest revision as of 17:27, 12 March 2024
Defined in header <system_error>
|
||
template< class T > struct is_error_condition_enum; |
(since C++11) | |
If T
is an error condition enum (such as std::errc), this template provides the member constant value
equal true. For any other type, value
is false.
This template may be specialized for a program-defined type to indicate that the type is eligible for std::error_condition implicit conversions.
Contents |
[edit] Helper variable template
template< class T > inline constexpr bool is_error_condition_enum_v = |
(since C++17) | |
Inherited from std::integral_constant
Member constants
value [static] |
true if T is an error condition enum, false otherwise (public static member constant) |
Member functions
operator bool |
converts the object to bool, returns value (public member function) |
operator() (C++14) |
returns value (public member function) |
Member types
Type | Definition |
value_type
|
bool |
type
|
std::integral_constant<bool, value> |
[edit] See also
(C++11) |
identifies a class as an error_code enumeration (class template) |