public virtual member function
<system_error>
(1) | virtual bool equivalent (int valcode, const error_condition& cond) const noexcept; |
---|
(2) | virtual bool equivalent (const error_code& code, int valcond) const noexcept; |
---|
Check error code equivalence
Checks whether, for the category, an error code is equivalent to an error condition.
This function is called by the overloads of comparison operators when an error_condition object is compared to an error_code object to check for equality or inequality. If either one of those objects' categories considers the other equivalent using this function, they are considered equivalent by the operator.
Its definition in the base class error_category is equivalent to:
1 2 3 4
|
virtual bool equivalent (int valcode, const error_condition& cond) const noexcept
{ return default_error_condition(valcode) == cond; }
virtual bool equivalent (const error_code& code, int valcond) const noexcept
{ return *this==code.category && code.value()==valcond; }
|
As a virtual member function, this behavior can be overridden in derived classes to define a different correspondence mechanism for each error_category type.
Two error_category objects can be compared directly, using its relational operator member functions.
Parameters
- code
- An object of an error_code type.
- cond
- An object of an error_condition type.
- valcode
- A numerical value identifying an error code.
- valcond
- A numerical value identifying an error condition.
If the error_category object is the generic_category, this argument is equivalent to an errno value (see errc for a list of standard values).
Return value
true
if the arguments are considered equivalent.
false
otherwise.