首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::owner_less

Defined in header <memory>

template<> struct owner_less<void>;

(since C++17)

std::owner_less<>std::owner_less并推导出参数类型。

成员类型

Member type

Definition

is_transparent

/* unspecified */

注记

成员类型is_transparent向调用方指示此函数对象是透明FunctionObject:它接受任意类型的参数,并使用完美的转发,这避免了在异构上下文中使用函数对象或使用rvalue参数时不必要的复制和转换。特别是模板函数,例如std::set::findstd::set::lower_bound在它们的Compare类型。

成员函数

operator()

compares its arguments using owner-based semantics (function)

STD:业主[医]再少点<void>*操作员%28%29

template<class T, class U> bool operator()( const std::shared_ptr<T>& lhs, const std::shared_ptr<U>& rhs ) const;

(since C++17)

template<class T, class U> bool operator()( const std::shared_ptr<T>& lhs, const std::weak_ptr<U>& rhs ) const;

(since C++17)

template<class T, class U> bool operator()( const std::weak_ptr<T>& lhs, const std::shared_ptr<U>& rhs ) const;

(since C++17)

template<class T, class U> bool operator()( const std::weak_ptr<T>& lhs, const std::weak_ptr<U>& rhs ) const;

(since C++17)

比较lhsrhs使用基于所有者的语义。有效呼叫lhs.owner_before(rhs)...

排序是严格弱序关系。

lhsrhs只有当它们都是空的或共享的所有权时,它们才是等价的。

参数

lhs, rhs

-

shared-ownership pointers to compare

返回值

true如果lhs少于rhs由业主依据订单确定。

例外

noexcept规格:

noexcept

另见

owner_before

provides owner-based ordering of shared pointers (public member function of std::shared_ptr)

owner_before

provides owner-based ordering of weak pointers (public member function of std::weak_ptr)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券