// <memory>// template< class T > class shared_ptr; (since C++11)template<classY>boolowner_before(const shared_ptr<Y>& other)constnoexcept;template<classY>boolowner_before(const std::weak_ptr<Y>& other)constnoexcept;
简述
Checks whether this shared_ptr precedes other in implementation defined owner-based (as opposed to value-based) order. The order is such that two smart pointers compare equivalent only if they are both empty or if they both own the same object, even if the values of the pointers obtained by get() are different (e.g. because they point at different subobjects within the same object)
This ordering is used to make shared and weak pointers usable as keys in associative containers, typically through std::owner_less.(用途:排序用,使shared_ptr或weak_ptr能作为关联容器的key)