operator==,!=(std::allocator)
自 C++20 起
// 1)
template< class T1, class T2 >
constexpr bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
从 C++11 起,直到 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;
直到 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();
比较两个默认分配器。由于默认分配器是无状态的,因此两个默认分配器始终相等。
- 返回 true
- 返回 false
参数
lhs
, rhs
- 要比较的默认分配器
返回值
- true
- false