Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::operator==,!=,<,<=>(std::error_code)

      From cppreference.com
      <cpp‎ |error‎ |error code
       
       
      Utilities library
       
      Diagnostics library
       
       
      Defined in header<system_error>
      bool operator==(conststd::error_code& lhs,
                       conststd::error_code& rhs)noexcept;
      (1)(since C++11)
      bool operator!=(conststd::error_code& lhs,
                       conststd::error_code& rhs)noexcept;
      (2)(since C++11)
      (until C++20)
      bool operator<(conststd::error_code& lhs,
                     conststd::error_code& rhs)noexcept;
      (3)(since C++11)
      (until C++20)
      std::strong_ordering operator<=>(conststd::error_code& lhs,
                                       conststd::error_code& rhs)noexcept;
      (4)(since C++20)

      Compares two error code objects.

      1) Compareslhs andrhs for equality.
      2) Compareslhs andrhs for equality.
      3) Checks whetherlhs is less thanrhs.
      4) Obtains three-way comparison result oflhs andrhs.

      The<,<=,>,>=, and!= operators aresynthesized fromoperator<=> andoperator== respectively.

      (since C++20)

      [edit]Parameters

      lhs, rhs - error codes to compare

      [edit]Return value

      1)true if the error category and error value compare equal.
      2)true if the error category or error value compare are not equal.
      3)true iflhs.category()< rhs.category(). Otherwise,true iflhs.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().

      [edit]See also

      obtains the error_category for this error_code
      (public member function)[edit]
      obtains the value of theerror_code
      (public member function)[edit]
      (removed in C++20)(removed in C++20)(C++20)
      compareserror_conditions anderror_codes
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/error/error_code/operator_cmp&oldid=156720"

      [8]ページ先頭

      ©2009-2025 Movatter.jp