std::owner_less
来自 cppreference.cn
定义于头文件 <memory> |
||
template<> struct owner_less<void>; |
(since C++17) | |
std::owner_less<void> 是 std::owner_less 的特化,带有推导的参数类型。
目录 |
[edit] 嵌套类型
嵌套类型 | 定义 |
is_transparent
|
未指定 |
[edit] 成员函数
operator() |
使用基于所有权的语义比较其参数 (函数) |
std::owner_less<void>::operator()
template< class T, class U > bool operator()( const std::shared_ptr<T>& lhs, |
(since C++17) | |
template< class T, class U > bool operator()( const std::shared_ptr<T>& lhs, |
(since C++17) | |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, |
(since C++17) | |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, |
(since C++17) | |
使用基于所有权的语义比较 lhs 和 rhs。 有效地调用 lhs.owner_before(rhs)。
排序是严格弱序关系。
lhs 和 rhs 仅当它们都为空或共享所有权时才等效。
参数
lhs, rhs | - | 要比较的共享所有权指针 |
返回值
true 如果 lhs 根据基于所有权的排序,小于 rhs。
[edit] 注解
特性测试 宏 | 值 | Std | 特性 |
---|---|---|---|
__cpp_lib_transparent_operators |
201510L |
(C++17) | 透明 std::owner_less (std::owner_less<void>) |
[edit] 参见
提供共享指针的基于所有权的排序 ( std::shared_ptr<T> 的公共成员函数) | |
提供弱指针的基于所有权的排序 ( std::weak_ptr<T> 的公共成员函数) |