名稱空間
變體
操作

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

來自 cppreference.com
< cpp‎ | 記憶體‎ | allocator
 
 
記憶體管理庫
(僅作說明*)
未初始化記憶體演算法
(C++17)
(C++17)
(C++17)
受約束的未初始化
記憶體演算法
C 庫

分配器
記憶體資源
垃圾回收支援
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
未初始化儲存
(直到 C++20*)
(直到 C++20*)
顯式生命週期管理
 
std::allocator
成員函式
(C++20 前)
(C++20 前)
(C++20 前)
(C++20 前)
非成員函式
operator==operator!=
(C++20 前)
 
(1)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();
(C++11 前)
template< class T1, class T2 >
bool operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
(C++11 起)
(C++20 前)
template< class T1, class T2 >

constexpr bool

    operator==( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
(C++20 起)
(2)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) throw();
(C++11 前)
template< class T1, class T2 >
bool operator!=( const allocator<T1>& lhs, const allocator<T2>& rhs ) noexcept;
(C++11 起)
(C++20 前)

比較兩個預設分配器。因為預設分配器是無狀態的,所以兩個預設分配器始終相等。

1) 返回 true
2) 返回 false

!= 運算子由 operator== 合成

(C++20 起)

[編輯] 引數

lhs, rhs - 要比較的預設分配器

[編輯] 返回值

1) true
2) false