std::owner_less
來自 cppreference.com
定義於標頭檔案 <memory> |
||
template<> struct owner_less<void>; |
(C++17 起) | |
std::owner_less<void> 是 std::owner_less 的特化,其引數型別被推導。
目錄 |
[編輯] 巢狀型別
巢狀型別 | 定義 |
is_transparent
|
未指定 |
[編輯] 成員函式
operator() |
使用基於所有權的語義比較其引數 (函式) |
std::owner_less<void>::operator()
template< class T, class U > bool operator()( const std::shared_ptr<T>& lhs, |
(C++17 起) | |
template< class T, class U > bool operator()( const std::shared_ptr<T>& lhs, |
(C++17 起) | |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, |
(C++17 起) | |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, |
(C++17 起) | |
使用基於所有者的語義比較 lhs 和 rhs。實際上呼叫 lhs.owner_before(rhs)。
此排序是嚴格弱序關係。
lhs 和 rhs 僅當它們都為空或共享所有權時才等價。
引數
lhs, rhs | - | 要比較的共享所有權指標 |
返回值
如果 lhs 按照基於所有者的排序“小於” rhs,則為 true。
[編輯] 註釋
特性測試宏 | 值 | 標準 | 特性 |
---|---|---|---|
__cpp_lib_transparent_operators |
201510L |
(C++17) | 透明 std::owner_less (std::owner_less<void>) |
[編輯] 參閱
提供共享指標的基於所有權的排序 ( std::shared_ptr<T> 的公共成員函式) | |
提供弱指標的基於所有權的排序 ( std::weak_ptr<T> 的公共成員函式) |