diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:41:18 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:43:11 +0900 |
commit | f763a99a501650eff2c60288aa6f10ef916d769e (patch) | |
tree | 02af7e13f9a38c888ebf340fe764cbe7dae99da9 /boost/smart_ptr | |
parent | 5cde13f21d36c7224b0e13d11c4b49379ae5210d (diff) | |
download | boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.gz boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.bz2 boost-f763a99a501650eff2c60288aa6f10ef916d769e.zip |
Imported Upstream version 1.62.0upstream/1.62.0
Change-Id: I9d4c1ddb7b7d8f0069217ecc582700f9fda6dd4c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/smart_ptr')
-rw-r--r-- | boost/smart_ptr/enable_shared_from_raw.hpp | 2 | ||||
-rw-r--r-- | boost/smart_ptr/intrusive_ptr.hpp | 26 | ||||
-rw-r--r-- | boost/smart_ptr/intrusive_ref_counter.hpp | 2 | ||||
-rw-r--r-- | boost/smart_ptr/shared_ptr.hpp | 19 |
4 files changed, 45 insertions, 4 deletions
diff --git a/boost/smart_ptr/enable_shared_from_raw.hpp b/boost/smart_ptr/enable_shared_from_raw.hpp index 669a6492b6..5cd3574e7c 100644 --- a/boost/smart_ptr/enable_shared_from_raw.hpp +++ b/boost/smart_ptr/enable_shared_from_raw.hpp @@ -104,7 +104,7 @@ private: } // Note: invoked automatically by shared_ptr; do not call - template<class X, class Y> void _internal_accept_owner( shared_ptr<X> * ppx, Y * py ) const + template<class X, class Y> void _internal_accept_owner( shared_ptr<X> * ppx, Y * ) const { BOOST_ASSERT( ppx != 0 ); diff --git a/boost/smart_ptr/intrusive_ptr.hpp b/boost/smart_ptr/intrusive_ptr.hpp index e5db609976..1e9339732b 100644 --- a/boost/smart_ptr/intrusive_ptr.hpp +++ b/boost/smart_ptr/intrusive_ptr.hpp @@ -59,7 +59,7 @@ public: typedef T element_type; - intrusive_ptr() BOOST_NOEXCEPT : px( 0 ) + BOOST_CONSTEXPR intrusive_ptr() BOOST_NOEXCEPT : px( 0 ) { } @@ -122,6 +122,30 @@ public: return *this; } + template<class U> friend class intrusive_ptr; + + template<class U> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + intrusive_ptr(intrusive_ptr<U> && rhs, typename boost::detail::sp_enable_if_convertible<U,T>::type = boost::detail::sp_empty()) + +#else + + intrusive_ptr(intrusive_ptr<U> && rhs) + +#endif + : px( rhs.px ) + { + rhs.px = 0; + } + + template<class U> + intrusive_ptr & operator=(intrusive_ptr<U> && rhs) BOOST_NOEXCEPT + { + this_type( static_cast< intrusive_ptr<U> && >( rhs ) ).swap(*this); + return *this; + } + #endif intrusive_ptr & operator=(intrusive_ptr const & rhs) diff --git a/boost/smart_ptr/intrusive_ref_counter.hpp b/boost/smart_ptr/intrusive_ref_counter.hpp index 82fa8bc3e3..b7587ea7a0 100644 --- a/boost/smart_ptr/intrusive_ref_counter.hpp +++ b/boost/smart_ptr/intrusive_ref_counter.hpp @@ -83,7 +83,7 @@ struct thread_safe_counter static unsigned int decrement(boost::detail::atomic_count& counter) BOOST_NOEXCEPT { - return --counter; + return static_cast< unsigned int >(--counter); } }; diff --git a/boost/smart_ptr/shared_ptr.hpp b/boost/smart_ptr/shared_ptr.hpp index bcefda8897..77f68bebd0 100644 --- a/boost/smart_ptr/shared_ptr.hpp +++ b/boost/smart_ptr/shared_ptr.hpp @@ -642,6 +642,14 @@ public: return *this; } + // aliasing move + template<class Y> + shared_ptr( shared_ptr<Y> && r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + #endif #if !defined( BOOST_NO_CXX11_NULLPTR ) @@ -679,7 +687,16 @@ public: { this_type( r, p ).swap( *this ); } - + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template<class Y> void reset( shared_ptr<Y> && r, element_type * p ) + { + this_type( static_cast< shared_ptr<Y> && >( r ), p ).swap( *this ); + } + +#endif + // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) typename boost::detail::sp_dereference< T >::type operator* () const { |