# operator==,!=(std::experimental::pmr::polymorphic_allocator)

> C++ Atlas: `cppatlas.com/w/cpp/experimental/polymorphic_allocator/operator_eq` | Source: https://en.cppreference.com/w/cpp/experimental/polymorphic_allocator/operator_eq | Domain: Technical specifications

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

## Official Specification Summary (cppreference)

```cpp
template< class T1, class T2 >
bool operator==( const polymorphic_allocator<T1>& lhs, const polymorphic_allocator<T2>& rhs ) noexcept;

template< class T1, class T2 >
bool operator!=( const polymorphic_allocator<T1>& lhs, const polymorphic_allocator<T2>& rhs ) noexcept;
```

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

1) Returns `*lhs.resource() == *rhs.resource()`.

2) Returns `!(lhs == rhs)`.

### Parameters

- `lhs, rhs` - polymorphic allocators to compare

### Return value

1) `*lhs.resource() == *rhs.resource()`

2) `!(lhs == rhs)`

---
Attribution: content from https://en.cppreference.com/w/cpp/experimental/polymorphic_allocator/operator_eq (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.