]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/smart_ptr/weak_ptr.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / smart_ptr / weak_ptr.hpp
index 07ba189f4ca8147ff561edfa877b69fb753aa8b5..16eea6777c411bb8732883523db96b4b6d5a20ab 100644 (file)
 //  See http://www.boost.org/libs/smart_ptr/ for documentation.
 //
 
-#include <memory> // boost.TR1 include order fix
 #include <boost/smart_ptr/detail/shared_count.hpp>
 #include <boost/smart_ptr/shared_ptr.hpp>
 #include <boost/smart_ptr/detail/sp_noexcept.hpp>
+#include <memory>
+#include <cstddef>
 
 namespace boost
 {
@@ -237,6 +238,21 @@ public:
         return pn < rhs.pn;
     }
 
+    template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
+    {
+        return pn == rhs.pn;
+    }
+
+    template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
+    {
+        return pn == rhs.pn;
+    }
+
+    std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT
+    {
+        return pn.hash_value();
+    }
+
 // Tasteless as this may seem, making all members public allows member templates
 // to work in the absence of member template friends. (Matthew Langston)
 
@@ -270,6 +286,40 @@ template<class T> weak_ptr( shared_ptr<T> ) -> weak_ptr<T>;
 
 #endif
 
+// hash_value
+
+template< class T > std::size_t hash_value( boost::weak_ptr<T> const & p ) BOOST_SP_NOEXCEPT
+{
+    return p.owner_hash_value();
+}
+
 } // namespace boost
 
+// std::hash, std::equal_to
+
+namespace std
+{
+
+#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
+
+template<class T> struct hash< ::boost::weak_ptr<T> >
+{
+    std::size_t operator()( ::boost::weak_ptr<T> const & p ) const BOOST_SP_NOEXCEPT
+    {
+        return p.owner_hash_value();
+    }
+};
+
+#endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
+
+template<class T> struct equal_to< ::boost::weak_ptr<T> >
+{
+    bool operator()( ::boost::weak_ptr<T> const & a, ::boost::weak_ptr<T> const & b ) const BOOST_SP_NOEXCEPT
+    {
+        return a.owner_equals( b );
+    }
+};
+
+} // namespace std
+
 #endif  // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED