Partager via


<system_error> operators

 

The latest version of this topic can be found at <system_error> operators.

operator!= operator< operator==

operator==

Tests if the object on the left side of the operator is equal to the object on the right side.

bool operator==(const error_code& left,
    const error_condition& right);

bool operator==(const error_condition& left,
    const error_code& right);

Parameters

Parameter Description
left The object to be tested for equality.
right The object to be tested for equality.

Return Value

true if the objects are equal; false if objects are not equal.

Remarks

This function returns left.category() == right.category() && left.value() == right.value().

operator!=

Tests if the object on the left side of the operator is not equal to the object on the right side.

bool operator!=(const error_code& left,
    const error_condition& right);

bool operator!=(const error_condition& left,
    const error_code& right);

Parameters

Parameter Description
left The object to be tested for inequality.
right The object to be tested for inequality.

Return Value

true if the object passed in left is not equal to the object passed in right; otherwise false.

Remarks

This function returns !(left == right).

operator<

Tests if an object is less than the object passed in for comparison.

template <class _Enum>  
inline bool operator<(
    _Enum left,
    typename enable_if<is_error_code_enum<_Enum>::value,
    const error_code&>::type right);

template <class _Enum>  
inline bool operator<(
    typename enable_if<is_error_code_enum<_Enum>::value,
    const error_code&>::type left, _Enum right);

template <class _Enum>  
inline bool operator<(
    _Enum left,
    typename enable_if<is_error_condition_enum<_Enum>::value,
    const error_condition&>::type right);

template <class _Enum>  
inline bool operator<(
    typename enable_if<is_error_condition_enum<_Enum>::value,
    const error_condition&>::type left, _Enum right);

Parameters

Parameter Description
left The object to be compared.
right The object to be compared.

Return Value

true if the object passed in left is less than the object passed in right; Otherwise, false.

Remarks

This function tests the error order.

See Also

<system_error>