BDE 4.14.0 Production release
|
Macros | |
#define | BSL_IS_ERROR_CONDITION_ENUM_NAMESPACE std |
Provide a compliant standard is_error_condition_enum
trait.
is_error_condition_enum
Canonical header: bsl_system_error.h
This component defines a class template, bsl::is_error_condition_enum
, intended to be specialized for enumeration types that are designated as error conditions for the <system_error>
facility. In C++11 mode, the vendor-supplied <system_error>
implementation is used instead, and the corresponding names from std
are imported into bsl
. This component also defines a macro, BSL_IS_ERROR_CONDITION_ENUM_NAMESPACE
, to be used as the namespace in which to write specializations of is_error_condition_enum
.
In this section we show intended use of this component.
Suppose we have a dedicated system with a set of possible errors, and we want to be able to throw descriptive exceptions when an error occurs. We need to work with the <system_error>
facility to support this, starting by marking the enumeration type that defines the error literals as eligible to participate. We can use bsl::is_error_condition
to do this.
First, we define the set of error values for our system.
Then, we enable the trait marking this as an error condition.
Finally, we verify that the trait marks our type as eligible.
#define BSL_IS_ERROR_CONDITION_ENUM_NAMESPACE std |