std::owner_less - cppreference.com
来自cppreference.com
template<> struct owner_less<void>; |
(C++17 起) | |
std::owner_less<void> 是拥有待推导形参类型的 std::owner_less 特化。
嵌套类型
| 嵌套类型 | 定义 |
is_transparent
|
未指定 |
成员函数
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; |
(1) | (C++17 起) (C++26 起为 constexpr) |
template< class T, class U > bool operator()( const std::shared_ptr<T>& lhs, const std::weak_ptr<U>& rhs ) const noexcept; |
(2) | (C++17 起) (C++26 起为 constexpr) |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, const std::shared_ptr<U>& rhs ) const noexcept; |
(3) | (C++17 起) (C++26 起为 constexpr) |
template< class T, class U > bool operator()( const std::weak_ptr<T>& lhs, const std::weak_ptr<U>& rhs ) const noexcept; |
(4) | (C++17 起) (C++26 起为 constexpr) |
用基于所有者的语义比较 lhs 与 rhs。相当于调用 lhs.owner_before(rhs)。
顺序是严格弱序关系。
仅当 lhs 与 rhs 都为空或共享所有权时才等价。
参数
返回值
在基于所有者的顺序确定 lhs 小于 rhs 时返回 true。
注解
| 功能特性测试宏 | 值 | 标准 | 功能特性 |
|---|---|---|---|
__cpp_lib_transparent_operators |
201510L |
(C++17) | 透明的 std::owner_less(std::owner_less<void>)
|
__cpp_lib_constexpr_memory |
202506L |
(C++26) | constexpr 的 std::owner_less<void>
|