diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp index bf5296a..d314b0d 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp @@ -63,22 +63,54 @@ public: template<class Y> #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - weak_ptr( weak_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() ) + weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) #else weak_ptr( weak_ptr<Y> const & r ) #endif - : pn(r.pn) // never throws + : px(r.lock().get()), pn(r.pn) // never throws { - px = r.lock().get(); } +#if defined( BOOST_HAS_RVALUE_REFS ) + + template<class Y> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr<Y> && r ) + +#endif + : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr & operator=( weak_ptr && r ) // never throws + { + this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); + return *this; + } + + +#endif + template<class Y> #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - weak_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() ) + weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) #else @@ -99,6 +131,17 @@ public: return *this; } +#if defined( BOOST_HAS_RVALUE_REFS ) + + template<class Y> + weak_ptr & operator=( weak_ptr<Y> && r ) + { + this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this ); + return *this; + } + +#endif + template<class Y> weak_ptr & operator=(shared_ptr<Y> const & r) // never throws { @@ -124,6 +167,11 @@ public: return pn.use_count() == 0; } + bool _empty() const // extension, not in std::weak_ptr + { + return pn.empty(); + } + void reset() // never throws in 1.30+ { this_type().swap(*this); |