diff --git a/compatibility.htm b/compatibility.htm index 71662ce..d520bd1 100644 --- a/compatibility.htm +++ b/compatibility.htm @@ -81,9 +81,8 @@

Revised 1 February 2002

-

Copyright 2002 Darin Adler. Permission to copy, use, modify, sell and distribute - this document is granted provided this copyright notice appears in all copies. - This document is provided "as is" without express or implied warranty, and with - no claim as to its suitability for any purpose.

+

Copyright 2002 Darin Adler. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.

diff --git a/intrusive_ptr.html b/intrusive_ptr.html index 24d8c32..c4eb899 100644 --- a/intrusive_ptr.html +++ b/intrusive_ptr.html @@ -61,7 +61,8 @@ intrusive_ptr & operator=(intrusive_ptr const & r); template<class Y> intrusive_ptr & operator=(intrusive_ptr<Y> const & r); - template<class Y> intrusive_ptr & operator=(T * r); + intrusive_ptr & operator=(T * r); + void reset(T * r); T & operator*() const; // never throws T * operator->() const; // never throws @@ -146,6 +147,11 @@ intrusive_ptr & operator=(T * r);

Effects: Equivalent to intrusive_ptr(r).swap(*this).

Returns: *this.

+

reset

+
void reset(T * r);
+
+

Effects: Equivalent to intrusive_ptr(r).swap(*this).

+

indirection

T & operator*() const; // never throws
diff --git a/scoped_array.htm b/scoped_array.htm index 93b1cf9..2d03509 100644 --- a/scoped_array.htm +++ b/scoped_array.htm @@ -108,10 +108,9 @@

Revised 09 January 2003

-

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Copyright 2002-2005 Peter Dimov. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. + Copyright 2002-2005 Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.

diff --git a/scoped_ptr.htm b/scoped_ptr.htm index 1c6458d..fc5785c 100644 --- a/scoped_ptr.htm +++ b/scoped_ptr.htm @@ -173,10 +173,9 @@ Buckle my shoe

Revised 09 January 2003

-

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Copyright 2002-2005 Peter Dimov. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. + Copyright 2002-2005 Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.

diff --git a/shared_array.htm b/shared_array.htm index 7c61f53..87bf61e 100644 --- a/shared_array.htm +++ b/shared_array.htm @@ -177,10 +177,9 @@ template<class T>

Revised 09 January 2003

-

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Copyright 2002-2005 Peter Dimov. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. + Copyright 2002-2005 Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.

diff --git a/shared_ptr.htm b/shared_ptr.htm index 71cb9c9..e108278 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -111,6 +111,7 @@ void bad() shared_ptr(shared_ptr const & r); // never throws template<class Y> shared_ptr(shared_ptr<Y> const & r); // never throws + template<class Y> shared_ptr(shared_ptr<Y> const & r, T * p); // never throws template<class Y> explicit shared_ptr(weak_ptr<Y> const & r); template<class Y> explicit shared_ptr(std::auto_ptr<Y> & r); @@ -122,6 +123,7 @@ void bad() template<class Y> void reset(Y * p); template<class Y, class D> void reset(Y * p, D d); template<class Y, class D, class A> void reset(Y * p, D d, A a); + template<class Y> void reset(shared_ptr<Y> const & r, T * p); // never throws T & operator*() const; // never throws T * operator->() const; // never throws @@ -253,6 +255,13 @@ template<class Y> shared_ptr(shared_ptr<Y> const & r); // never r.use_count().

Throws: nothing.

+
template<class Y> shared_ptr(shared_ptr<Y> const & r, T * p); // never throws
+
+

Effects: constructs a shared_ptr that shares ownership with + r and stores p.

+

Postconditions: get() == p && use_count() == r.use_count().

+

Throws: nothing.

+
template<class Y> explicit shared_ptr(weak_ptr<Y> const & r);

Effects: Constructs a shared_ptr that shares ownership with @@ -328,6 +337,10 @@ q = p;

Effects: Equivalent to shared_ptr(p, d, a).swap(*this).

+
template<class Y> void reset(shared_ptr<Y> const & r, T * p); // never throws
+
+

Effects: Equivalent to shared_ptr(r, p).swap(*this).

+

indirection

T & operator*() const; // never throws
@@ -696,9 +709,8 @@ int * p = a.release();

$Date$

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Copyright 2002-2005 Peter Dimov. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

+ Copyright 2002-2005 Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.

diff --git a/smart_ptr.htm b/smart_ptr.htm index 14f456b..5fb0e8d 100644 --- a/smart_ptr.htm +++ b/smart_ptr.htm @@ -177,10 +177,9 @@ and an extensive bibliography.


$Date$

-

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Permission to copy, use, modify, sell and distribute this document is granted - provided this copyright notice appears in all copies. This document is provided - "as is" without express or implied warranty, and with no claim as to its - suitability for any purpose.

+

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. + Distributed under the Boost Software License, Version 1.0. See accompanying + file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt.

diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fbb1657..e6b49d7 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.SmartPtr Library test Jamfile # -# Copyright (c) 2003-2005 Peter Dimov +# Copyright (c) 2003-2007 Peter Dimov # Copyright (c) 2003 Dave Abrahams # # Distributed under the Boost Software License, Version 1.0. (See @@ -23,9 +23,15 @@ import testing ; [ run lw_mutex_test.cpp ] [ compile-fail shared_ptr_assign_fail.cpp ] [ compile-fail shared_ptr_delete_fail.cpp ] + [ compile-fail shared_ptr_compare_fail.cpp ] [ run shared_ptr_alloc2_test.cpp ] [ run pointer_cast_test.cpp ] [ compile pointer_to_other_test.cpp ] [ run auto_ptr_rv_test.cpp ] + [ run shared_ptr_alias_test.cpp ] + [ run shared_ptr_rv_test.cpp ] + [ run shared_ptr_move_test.cpp ] + [ compile-fail shared_ptr_pv_fail.cpp ] + [ run sp_unary_addr_test.cpp ] ; } diff --git a/test/smart_ptr_test.cpp b/test/smart_ptr_test.cpp index 27cba2b..0c29c9c 100644 --- a/test/smart_ptr_test.cpp +++ b/test/smart_ptr_test.cpp @@ -40,9 +40,9 @@ #include -#include #include #include +#include class Incomplete; @@ -51,12 +51,6 @@ Incomplete * get_ptr( boost::shared_ptr& incomplete ) return incomplete.get(); } -using namespace std; -using boost::scoped_ptr; -using boost::scoped_array; -using boost::shared_ptr; -using boost::shared_array; - template void ck( const T* v1, T v2 ) { BOOST_TEST( *v1 == v2 ); } @@ -72,7 +66,7 @@ class UDT { explicit UDT( long value=0 ) : value_(value) { ++UDT_use_count; } ~UDT() { --UDT_use_count; - cout << "UDT with value " << value_ << " being destroyed\n"; + std::cout << "UDT with value " << value_ << " being destroyed\n"; } long value() const { return value_; } void value( long v ) { value_ = v;; } @@ -86,16 +80,16 @@ class UDT { class Incomplete; -Incomplete * check_incomplete( scoped_ptr& incomplete ) +Incomplete * check_incomplete( boost::scoped_ptr& incomplete ) { return incomplete.get(); } -Incomplete * check_incomplete( shared_ptr& incomplete, - shared_ptr& i2 ) +Incomplete * check_incomplete( boost::shared_ptr& incomplete, + boost::shared_ptr& i2 ) { incomplete.swap(i2); - cout << incomplete.use_count() << ' ' << incomplete.unique() << '\n'; + std::cout << incomplete.use_count() << ' ' << incomplete.unique() << '\n'; return incomplete.get(); } @@ -107,7 +101,7 @@ void test() // test scoped_ptr with a built-in type long * lp = new long; - scoped_ptr sp ( lp ); + boost::scoped_ptr sp ( lp ); BOOST_TEST( sp.get() == lp ); BOOST_TEST( lp == sp.get() ); BOOST_TEST( &*sp == lp ); @@ -122,7 +116,7 @@ void test() BOOST_TEST( sp.get() == 0 ); // test scoped_ptr with a user defined type - scoped_ptr udt_sp ( new UDT( 999888777 ) ); + boost::scoped_ptr udt_sp ( new UDT( 999888777 ) ); BOOST_TEST( udt_sp->value() == 999888777 ); udt_sp.reset(); udt_sp.reset( new UDT( 111222333 ) ); @@ -132,7 +126,7 @@ void test() // test scoped_array with a build-in type char * sap = new char [ 100 ]; - scoped_array sa ( sap ); + boost::scoped_array sa ( sap ); BOOST_TEST( sa.get() == sap ); BOOST_TEST( sap == sa.get() ); @@ -152,7 +146,7 @@ void test() // test shared_ptr with a built-in type int * ip = new int; - shared_ptr cp ( ip ); + boost::shared_ptr cp ( ip ); BOOST_TEST( ip == cp.get() ); BOOST_TEST( cp.use_count() == 1 ); @@ -162,7 +156,7 @@ void test() ck( static_cast(cp.get()), 54321 ); ck( static_cast(ip), *cp ); - shared_ptr cp2 ( cp ); + boost::shared_ptr cp2 ( cp ); BOOST_TEST( ip == cp2.get() ); BOOST_TEST( cp.use_count() == 2 ); BOOST_TEST( cp2.use_count() == 2 ); @@ -172,7 +166,7 @@ void test() ck( static_cast(cp2.get()), 54321 ); ck( static_cast(ip), *cp2 ); - shared_ptr cp3 ( cp ); + boost::shared_ptr cp3 ( cp ); BOOST_TEST( cp.use_count() == 3 ); BOOST_TEST( cp2.use_count() == 3 ); BOOST_TEST( cp3.use_count() == 3 ); @@ -202,20 +196,20 @@ void test() BOOST_TEST( cp.use_count() == 3 ); BOOST_TEST( *cp == 87654 ); - shared_ptr cp4; + boost::shared_ptr cp4; swap( cp2, cp4 ); BOOST_TEST( cp4.use_count() == 3 ); BOOST_TEST( *cp4 == 87654 ); BOOST_TEST( cp2.get() == 0 ); - set< shared_ptr > scp; + std::set< boost::shared_ptr > scp; scp.insert(cp4); BOOST_TEST( scp.find(cp4) != scp.end() ); - BOOST_TEST( scp.find(cp4) == scp.find( shared_ptr(cp4) ) ); + BOOST_TEST( scp.find(cp4) == scp.find( boost::shared_ptr(cp4) ) ); // test shared_array with a built-in type char * cap = new char [ 100 ]; - shared_array ca ( cap ); + boost::shared_array ca ( cap ); BOOST_TEST( ca.get() == cap ); BOOST_TEST( cap == ca.get() ); BOOST_TEST( &ca[0] == cap ); @@ -227,8 +221,8 @@ void test() BOOST_TEST( ca[0] == 'H' ); BOOST_TEST( ca[30] == 'h' ); - shared_array ca2 ( ca ); - shared_array ca3 ( ca2 ); + boost::shared_array ca2 ( ca ); + boost::shared_array ca3 ( ca2 ); ca[0] = 'N'; ca[4] = 'd'; @@ -246,24 +240,24 @@ void test() ca.reset(); BOOST_TEST( ca.get() == 0 ); - shared_array ca4; + boost::shared_array ca4; swap( ca3, ca4 ); BOOST_TEST( ca4.use_count() == 1 ); BOOST_TEST( strcmp( ca4.get(), "Not dog with mustard and relish" ) == 0 ); BOOST_TEST( ca3.get() == 0 ); - set< shared_array > sca; + std::set< boost::shared_array > sca; sca.insert(ca4); BOOST_TEST( sca.find(ca4) != sca.end() ); - BOOST_TEST( sca.find(ca4) == sca.find( shared_array(ca4) ) ); + BOOST_TEST( sca.find(ca4) == sca.find( boost::shared_array(ca4) ) ); // test shared_array with user defined type - shared_array udta ( new UDT[3] ); + boost::shared_array udta ( new UDT[3] ); udta[0].value( 111 ); udta[1].value( 222 ); udta[2].value( 333 ); - shared_array udta2 ( udta ); + boost::shared_array udta2 ( udta ); BOOST_TEST( udta[0].value() == 111 ); BOOST_TEST( udta[1].value() == 222 ); @@ -280,7 +274,7 @@ void test() // test shared_ptr with a user defined type UDT * up = new UDT; - shared_ptr sup ( up ); + boost::shared_ptr sup ( up ); BOOST_TEST( up == sup.get() ); BOOST_TEST( sup.use_count() == 1 ); @@ -288,7 +282,7 @@ void test() BOOST_TEST( sup->value() == 54321 ); BOOST_TEST( up->value() == 54321 ); - shared_ptr sup2; + boost::shared_ptr sup2; sup2 = sup; BOOST_TEST( sup2->value() == 54321 ); BOOST_TEST( sup.use_count() == 2 ); @@ -298,7 +292,7 @@ void test() BOOST_TEST( sup.use_count() == 2 ); BOOST_TEST( sup2.use_count() == 2 ); - cout << "OK\n"; + std::cout << "OK\n"; new char[12345]; // deliberate memory leak to verify leaks detected } diff --git a/weak_ptr.htm b/weak_ptr.htm index 68dc980..0fa87f7 100644 --- a/weak_ptr.htm +++ b/weak_ptr.htm @@ -235,10 +235,8 @@ public:

$Date$

Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler. - Copyright 2002-2005 Peter Dimov. Permission to copy, use, modify, sell and - distribute this document is granted provided this copyright notice appears in - all copies. This document is provided "as is" without express or implied - warranty, and with no claim as to its suitability for any purpose.

- + Copyright 2002-2005 Peter Dimov. Distributed under the Boost Software License, Version + 1.0. See accompanying file LICENSE_1_0.txt or + copy at http://www.boost.org/LICENSE_1_0.txt.