Namespaces
Variants

std:: owner_less

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
定义于头文件 <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,

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

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

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

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

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

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

const std:: weak_ptr < U > & rhs ) const noexcept ;
(自 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> 的公开成员函数)