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::find和std::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) |
比较lhs和rhs使用基于所有者的语义。有效呼叫lhs.owner_before(rhs)...
排序是严格弱序关系。
lhs和rhs只有当它们都是空的或共享的所有权时,它们才是等价的。
参数
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) |
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

