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> 的公开成员函数) |