function
<system_error>

std::relational operators (error_code)

vs error_code(1)
bool operator== (const error_code& lhs, const error_code& rhs) noexcept;bool operator!= (const error_code& lhs, const error_code& rhs) noexcept;bool operator<  (const error_code& lhs, const error_code& rhs) noexcept;
vs error_condition(2)
bool operator== (const error_code& lhs, const error_condition& rhs) noexcept;bool operator== (const error_condition& lhs, const error_code& rhs) noexcept;bool operator!= (const error_code& lhs, const error_condition& rhs) noexcept;bool operator!= (const error_condition& lhs, const error_code& rhs) noexcept;
Relational operators
Returns the result of the relational operation between lhs and rhs.

When the comparison involves two objects of type error_code:
  • if they are of the same category, the function returns the result of applying the appropriate operator (==, !=, <) on their associated values.
  • otherwise, the function returns the result of applying the operator (==, !=, <) to their categories.

If the operation involves an error_code object and an error_condition object, the function calls to error_category::equivalent to determine whether they are equivalent.

These functions behave as if defined as:
1
2
3
4
5
6
7
8
9
10
11
12
bool operator== (const error_code& lhs, const error_code& rhs) noexcept
{ return lhs.category()==rhs.category() && lhs.value()==rhs.value(); }
bool operator!= (const error_code& lhs, const error_code& rhs) noexcept { return !(lhs==rhs); }
bool operator<  (const error_code& lhs, const error_code& rhs) noexcept
{ return lhs.category()<rhs.category() || lhs.category()==rhs.category()&&lhs.value()<rhs.value(); }

bool operator== (const error_code& lhs, const error_condition& rhs) noexcept
{ return lhs.category().equivalent(lhs.value,rhs) || rhs.category().equivalent(lhs,rhs.value()); }
bool operator== (const error_condition& lhs, const error_code& rhs) noexcept
{ return lhs.category().equivalent(lhs.value,rhs) || rhs.category().equivalent(lhs,rhs.value()); }
bool operator!= (const error_code& lhs, const error_condition& rhs) noexcept { return !(lhs==rhs); }
bool operator!= (const error_condition& lhs, const error_code& rhs) noexcept { return !(lhs==rhs); }

Parameters

lhs, rhs
Objects (to the left- and right-hand side of the operator, respectively).

Return value

true if the condition holds, and false otherwise.

See also