| description | Learn more about: error_code Class | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| title | error_code Class | ||||||||
| ms.date | 11/04/2016 | ||||||||
| f1_keywords |
|
||||||||
| helpviewer_keywords |
|
||||||||
| ms.assetid | c09b4a96-cb14-4281-a319-63543f9b2b4a |
Represents low-level system errors that are implementation-specific.
class error_code;An object of type error_code class stores an error code value and a pointer to an object that represents a category of error codes that describe reported low-level system errors.
| Name | Description |
|---|---|
| error_code | Constructs an object of type error_code. |
| Name | Description |
|---|---|
| value_type | A type that represents the stored error code value. |
| Name | Description |
|---|---|
| assign | Assigns an error code value and category to an error code. |
| category | Returns the error category. |
| clear | Clears the error code value and category. |
| default_error_condition | Returns the default error condition. |
| message | Returns the name of the error code. |
| Name | Description |
|---|---|
| operator== | Tests for equality between error_code objects. |
| operator!= | Tests for inequality between error_code objects. |
| operator< | Tests if the error_code object is less than the error_code object passed in for comparison. |
| operator= | Assigns a new enumeration value to the error_code object. |
| operator bool | Casts a variable of type error_code. |
Assigns an error code value and category to an error code.
void assign(value_type val, const error_category& _Cat);val
The error code value to store in the error_code.
_Cat
The error category to store in the error_code.
The member function stores val as the error code value and a pointer to _Cat.
Returns the error category.
const error_category& category() const;Clears the error code value and category.
clear();The member function stores a zero error code value and a pointer to the generic_category object.
Returns the default error condition.
error_condition default_error_condition() const;The error_condition specified by default_error_condition.
This member function returns category().default_error_condition(value()).
Constructs an object of type error_code.
error_code();
error_code(value_type val, const error_category& _Cat);
template <class _Enum>
error_code(_Enum _Errcode,
typename enable_if<is_error_code_enum<_Enum>::value,
error_code>::type* = 0);val
The error code value to store in the error_code.
_Cat
The error category to store in the error_code.
_Errcode
The enumeration value to store in the error_code.
The first constructor stores a zero error code value and a pointer to the generic_category.
The second constructor stores val as the error code value and a pointer to error_category.
The third constructor stores (value_type)_Errcode as the error code value and a pointer to the generic_category.
Returns the name of the error code.
string message() const;A string representing the name of the error code.
This member function returns category().message(value()).
Tests for equality between error_code objects.
bool operator==(const error_code& right) const;right
The object to be tested for equality.
true if the objects are equal; false if objects are not equal.
The member operator returns category() == right.category() && value == right.value().
Tests for inequality between error_code objects.
bool operator!=(const error_code& right) const;right
The object to be tested for inequality.
true if the error_code object is not equal to the error_code object passed in right; otherwise false.
The member operator returns !(*this == right).
Tests if the error_code object is less than the error_code object passed in for comparison.
bool operator<(const error_code& right) const;right
The error_code object to be compared.
true if the error_code object is less than the error_code object passed in for comparison; Otherwise, false.
The member operator returns category() < right.category() || category() == right.category() && value < right.value().
Assigns a new enumeration value to the error_code object.
template <class _Enum>
typename enable_if<is_error_code_enum<_Enum>::value, error_code>::type&
operator=(_Enum _Errcode);_Errcode
The enumeration value to assign to the error_code object.
A reference to the error_code object that is being assigned the new enumeration value by the member function.
The member operator stores (value_type)_Errcode as the error code value and a pointer to the generic_category. It returns *this.
Casts a variable of type error_code.
explicit operator bool() const;The Boolean value of the error_code object.
The operator returns a value convertible to true only if value is not equal to zero. The return type is convertible only to bool, not to void * or other known scalar types.
Returns the stored error code value.
value_type value() const;The stored error code value of type value_type.
A type that represents the stored error code value.
typedef int value_type;This type definition is a synonym for int.