命名空间
变体
操作

std::owner_less

来自 cppreference.cn
< cpp‎ | memory
 
 
内存管理库
(仅为说明目的*)
未初始化内存算法
(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*)
显式生命周期管理
 
定义于头文件 <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,

                 const std::shared_ptr<U>& rhs ) const noexcept;
(since C++17)
template< class T, class U >

bool operator()( const std::shared_ptr<T>& lhs,

                 const std::weak_ptr<U>& rhs ) const noexcept;
(since C++17)
template< class T, class U >

bool operator()( const std::weak_ptr<T>& lhs,

                 const std::shared_ptr<U>& rhs ) const noexcept;
(since C++17)
template< class T, class U >

bool operator()( const std::weak_ptr<T>& lhs,

                 const std::weak_ptr<U>& rhs ) const noexcept;
(since C++17)

使用基于所有权的语义比较 lhsrhs。 有效地调用 lhs.owner_before(rhs)

排序是严格弱序关系。

lhsrhs 仅当它们都为空或共享所有权时才等效。

参数

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> 的公共成员函数) [编辑]