Skip to main content

operator==,!=(std::allocator)

Since C++20
// 1)
template< class T1, class T2 >
constexpr bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
Since C++11, Until C++20
// 1)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
// 2)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
Until C++11
// 1)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();
// 2)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();

Compares two default allocators. Since default allocators are stateless, two default allocators are always equal.

  1. Returns true
  2. Returns false
The != operator is synthesized from operator==. (since C++20)

Parameters

lhs, rhs - default allocators to compare

Return value

  1. true
  2. false

operator==,!=(std::allocator)

Since C++20
// 1)
template< class T1, class T2 >
constexpr bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
Since C++11, Until C++20
// 1)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
// 2)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
Until C++11
// 1)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();
// 2)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();

Compares two default allocators. Since default allocators are stateless, two default allocators are always equal.

  1. Returns true
  2. Returns false
The != operator is synthesized from operator==. (since C++20)

Parameters

lhs, rhs - default allocators to compare

Return value

  1. true
  2. false