Merged in smart_ptr changes from the sandbox/boost0x branch created for

BoostCon '09.  This adds move semantics to weak_ptr and intrusive_ptr.


[SVN r52937]
This commit is contained in:
Timothy Zachary Laine
2009-05-12 16:18:15 +00:00
parent 4b4a62513f
commit fc12543814
8 changed files with 393 additions and 12 deletions
+8 -8
View File
@@ -8,11 +8,11 @@
// http://www.boost.org/LICENSE_1_0.txt
//
#if defined( BOOST_HAS_RVALUE_REFS )
#include <boost/shared_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
#if defined( BOOST_HAS_RVALUE_REFS )
struct X
{
static long instances;
@@ -43,11 +43,11 @@ int main()
boost::shared_ptr<X> p( new X );
BOOST_TEST( X::instances == 1 );
boost::shared_ptr<X> p2( static_cast< boost::shared_ptr<X> && >( p ) );
boost::shared_ptr<X> p2( std::move( p ) );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p.get() == 0 );
boost::shared_ptr<void> p3( static_cast< boost::shared_ptr<X> && >( p2 ) );
boost::shared_ptr<void> p3( std::move( p2 ) );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p2.get() == 0 );
@@ -60,12 +60,12 @@ int main()
BOOST_TEST( X::instances == 1 );
boost::shared_ptr<X> p2;
p2 = static_cast< boost::shared_ptr<X> && >( p );
p2 = std::move( p );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p.get() == 0 );
boost::shared_ptr<void> p3;
p3 = static_cast< boost::shared_ptr<X> && >( p2 );
p3 = std::move( p2 );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p2.get() == 0 );
@@ -79,13 +79,13 @@ int main()
boost::shared_ptr<X> p2( new X );
BOOST_TEST( X::instances == 2 );
p2 = static_cast< boost::shared_ptr<X> && >( p );
p2 = std::move( p );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p.get() == 0 );
boost::shared_ptr<void> p3( new X );
BOOST_TEST( X::instances == 2 );
p3 = static_cast< boost::shared_ptr<X> && >( p2 );
p3 = std::move( p2 );
BOOST_TEST( X::instances == 1 );
BOOST_TEST( p2.get() == 0 );