std::operat...error_code)(3)
π std::operator==,!=,(std::error_code)(3) π
okay so bestie, this is from the C++ Standard Libary manual (yes, that spelling is in the header π), and it's all about comparing std::error_code objects. It's giving operator-overload realness, and every single overload here is noexcept. No cap. β¨
β¨ Synopsis β¨
Defined in header <system_error>, bestie. Here's the synopsis, preserved exactly so nothing gets lost:
Defined in header <system_error>
bool operator==( const std::error_code& lhs,
(1) (since C++11)
const std::error_code& rhs ) noexcept;
bool operator!=( const std::error_code& lhs,
(2) (since C++11)
const std::error_code& rhs ) noexcept;
(until C++20)
bool operator<( const std::error_code& lhs,
(3) (since C++11)
const std::error_code& rhs ) noexcept;
(until C++20)
std::strong_ordering operator<=>( const std::error_code& lhs,
const std::error_code& rhs )
(4) (since C++20)
noexcept;
The big picture: it compares two error code objects. π«Ά
- (1)
(since C++11)β Compareslhsandrhsfor equality. - (2)
(since C++11),(until C++20)β Compareslhsandrhsfor equality. - (3)
(since C++11),(until C++20)β Checks whetherlhsis less thanrhs. - (4)
(since C++20)β Obtains the three-way comparison result oflhsandrhs.
Also: the <, <=, >, >=, and != operators are synthesized from operator<=> (since C++20) and operator== respectively. periodt. π
π Parameters π
lhs,rhsβ error codes to compare.
Two error codes walk into a comparison operator. That's the whole parameter list, bestie. π
π₯ Return value π₯
- (1)
trueif the error category and error value compare equal. - (2)
trueif the error category or error value compare are not equal. - (3)
trueiflhs.category() < rhs.category(). Otherwise,trueiflhs.category() == rhs.category() && lhs.value() < rhs.value(). Otherwise,false. - (4)
lhs.category() <=> rhs.category()if it is notstd::strong_ordering::equal. Otherwise,lhs.value() <=> rhs.value().
That's the whole return-value vibe check. π₯
π See also π
categoryβ obtains theerror_categoryfor thiserror_code(public member function).valueβ obtains the value of theerror_code(public member function).operator==operator!=operator<β compareserror_conditionsanderror_codes.operator<=>β (function).(removed in C++20)(removed in C++20)(C++20)
That's the whole page, bestie π Big cute sign-off: source/version is http://cppreference.com, and the date on this one is 2024.06.10. π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms