Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::pmr::operator==,std::pmr::operator!=

      From cppreference.com
      <cpp‎ |memory‎ |polymorphic allocator
       
       
      Memory management library
      (exposition only*)
      Allocators
      Uninitialized memory algorithms
      Constrained uninitialized memory algorithms
      Memory resources
      Uninitialized storage(until C++20)
      (until C++20*)
      (until C++20*)
      Garbage collector support(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
       
       
      Defined in header<memory_resource>
      template<class T1,class T2>

      bool operator==(conststd::pmr::polymorphic_allocator<T1>& lhs,

                       conststd::pmr::polymorphic_allocator<T2>& rhs)noexcept;
      (1)(since C++17)
      friendbool operator==(const polymorphic_allocator& lhs,
                             const polymorphic_allocator& rhs)noexcept;
      (2)(since C++17)
      template<class T1,class T2>

      bool operator!=(conststd::pmr::polymorphic_allocator<T1>& lhs,

                       conststd::pmr::polymorphic_allocator<T2>& rhs)noexcept;
      (3)(since C++17)
      (until C++20)
      friendbool operator!=(const polymorphic_allocator& lhs,
                             const polymorphic_allocator& rhs)noexcept;
      (4)(since C++17)
      (until C++20)

      Compares two polymorphic allocators. Two polymorphic allocators compare equal if their underlying memory resource compares equal.

      1) Returns*lhs.resource()==*rhs.resource().
      2) Same as(1), allowing conversion topolymorphic_allocator.
      This function is not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup when std::pmr::polymorphic_allocator is an associated class of the arguments.
      3) Returns!(lhs== rhs).
      4) Same as(3), allowing conversion topolymorphic_allocator.
      This function is not visible to ordinaryunqualified orqualified lookup, and can only be found byargument-dependent lookup when std::pmr::polymorphic_allocator is an associated class of the arguments.

      The!= operator issynthesized fromoperator==.

      (since C++20)

      [edit]Parameters

      lhs, rhs - polymorphic allocators to compare

      [edit]Return value

      1,2)*lhs.resource()==*rhs.resource()
      3,4)!(lhs== rhs)

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3683C++17polymorphic_allocator could not be compared with types convertible to itoverload added
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/polymorphic_allocator/operator_eq&oldid=160246"

      [8]ページ先頭

      ©2009-2026 Movatter.jp