scoped_allocator_adaptor_operator_cmp

scoped_allocator_adaptor_operator_cmp (scoped_allocator_adaptor 비교 연산자)

<scoped_allocator> 헤더에 정의되어 있어요. 두 std::scoped_allocator_adaptor 객체를 비교해요. C++11부터 도입됐어요.

출처: cppreference

본문

template< class OuterAlloc1, class OuterAlloc2, class... InnerAllocs >
bool operator==( const scoped_allocator_adaptor<OuterAlloc1, InnerAllocs...>& lhs,
                 const scoped_allocator_adaptor<OuterAlloc2, InnerAllocs...>& rhs ) noexcept;   // (1) since C++11

template< class OuterAlloc1, class OuterAlloc2, class... InnerAllocs >
bool operator!=( const scoped_allocator_adaptor<OuterAlloc1, InnerAllocs...>& lhs,
                 const scoped_allocator_adaptor<OuterAlloc2, InnerAllocs...>& rhs ) noexcept;   // (2) until C++20

scoped_allocator_adaptor가 동등한지 비교해요. 비교는 기본적으로 각 할당자 타입의 operator==를 이용해 수행돼요.

  • (1) lhsrhs가 동등하면 true.
  • (2) C++20에서 제거된 operator!=!(lhs == rhs)를 돌려주는 방식으로 동작했어요.

scoped_allocator_adaptor는 내부 할당자 집합을 비교하므로, 두 어댑터의 모든 구성 할당자가 동등해야 동등한 것으로 간주돼요. 같은 메모리 풀을 공유하는지 여부는 각 할당자의 operator== 의미에 따라 달라져요.

더 알아보기 (Learn more)

cppreference