forked from boostorg/smart_ptr
Made the Boost logo link to the home page
[SVN r31112]
This commit is contained in:
@ -1,105 +1,89 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
<head>
|
<title>Smart Pointer Changes</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
<title>Smart Pointer Changes</title>
|
</head>
|
||||||
</head>
|
<body bgcolor="#ffffff" text="#000000">
|
||||||
|
<h1><A href="../../index.htm"><img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86"
|
||||||
<body bgcolor="#FFFFFF" text="#000000">
|
border="0"></A>Smart Pointer Changes</h1>
|
||||||
|
<p>The February 2002 change to the Boost smart pointers introduced a number of
|
||||||
<h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86">Smart
|
changes. Since the previous version of the smart pointers was in use for a long
|
||||||
Pointer Changes</h1>
|
time, it's useful to have a detailed list of what changed from a library user's
|
||||||
|
point of view.</p>
|
||||||
<p>The February 2002 change to the Boost smart pointers introduced a number
|
<p>Note that for compilers that don't support member templates well enough, a
|
||||||
of changes. Since the previous version of the smart pointers was in use for
|
separate implementation is used that lacks many of the new features and is more
|
||||||
a long time, it's useful to have a detailed list of what changed from a library
|
like the old version.</p>
|
||||||
user's point of view.</p>
|
<h2>Features Requiring Code Changes to Take Advantage</h2>
|
||||||
|
<ul>
|
||||||
<p>Note that for compilers that don't support member templates well enough,
|
<li>
|
||||||
a separate implementation is used that lacks many of the new features and is
|
The smart pointer class templates now each have their own header file. For
|
||||||
more like the old version.</p>
|
compatibility, the <a href="../../boost/smart_ptr.hpp"><boost/smart_ptr.hpp></a>
|
||||||
|
header now includes the headers for the four classic smart pointer class
|
||||||
<h2>Features Requiring Code Changes to Take Advantage</h2>
|
templates.
|
||||||
|
<li>
|
||||||
<ul>
|
The <b>weak_ptr</b>
|
||||||
|
template was added.
|
||||||
<li>The smart pointer class templates now each have their own header file.
|
<li>
|
||||||
For compatibility, the
|
The new <b>shared_ptr</b> and <b>shared_array</b> relax the requirement that
|
||||||
<a href="../../boost/smart_ptr.hpp"><boost/smart_ptr.hpp></a>
|
the pointed-to object's destructor must be visible when instantiating the <b>shared_ptr</b>
|
||||||
header now includes the headers for the four classic smart pointer class templates.</li>
|
destructor. This makes it easier to have shared_ptr members in classes without
|
||||||
|
explicit destructors.
|
||||||
<li>The <b>weak_ptr</b> template was added.</li>
|
<li>
|
||||||
|
A custom deallocator can be passed in when creating a <b>shared_ptr</b> or <b>shared_array</b>.
|
||||||
<li>The new <b>shared_ptr</b> and <b>shared_array</b> relax the requirement that the pointed-to object's
|
<li>
|
||||||
destructor must be visible when instantiating the <b>shared_ptr</b> destructor.
|
<b>shared_static_cast</b> and <b>shared_dynamic_cast</b> function templates are
|
||||||
This makes it easier to have shared_ptr members in classes without explicit destructors.</li>
|
provided which work for <b>shared_ptr</b> and <b>weak_ptr</b> as <b>static_cast</b>
|
||||||
|
and <b>dynamic_cast</b>
|
||||||
<li>A custom deallocator can be passed in when creating a <b>shared_ptr</b> or <b>shared_array</b>.</li>
|
do for pointers.
|
||||||
|
<li>
|
||||||
<li><b>shared_static_cast</b> and <b>shared_dynamic_cast</b> function templates are
|
The self-assignment misfeature has been removed from <b>shared_ptr::reset</b>,
|
||||||
provided which work for <b>shared_ptr</b> and <b>weak_ptr</b> as <b>static_cast</b> and
|
although it is still present in <b>scoped_ptr</b>, and in <b>std::auto_ptr</b>.
|
||||||
<b>dynamic_cast</b> do for pointers.</li>
|
Calling <b>reset</b> with a pointer to the object that's already owned by the <b>shared_ptr</b>
|
||||||
|
results in undefined behavior (an assertion, or eventually a double-delete if
|
||||||
<li>The self-assignment misfeature has been removed from <b>shared_ptr::reset</b>,
|
assertions are off).
|
||||||
although it is still present in <b>scoped_ptr</b>, and in <b>std::auto_ptr</b>.
|
<li>
|
||||||
Calling <b>reset</b> with a pointer to the object that's already owned by the
|
The <b>BOOST_SMART_PTR_CONVERSION</b>
|
||||||
<b>shared_ptr</b> results in undefined behavior
|
feature has been removed.
|
||||||
(an assertion, or eventually a double-delete if assertions are off).</li>
|
<li>
|
||||||
|
<b>shared_ptr<void></b> is now allowed.</li>
|
||||||
<li>The <b>BOOST_SMART_PTR_CONVERSION</b> feature has been removed.</li>
|
</ul>
|
||||||
|
<h2>Features That Improve Robustness</h2>
|
||||||
<li><b>shared_ptr<void></b> is now allowed.</li>
|
<ul>
|
||||||
|
<li>
|
||||||
</ul>
|
The manipulation of use counts is now <a name="threadsafe">thread safe</a> on
|
||||||
|
Windows, Linux, and platforms that support pthreads. See the <a href="../../boost/detail/atomic_count.hpp">
|
||||||
<h2>Features That Improve Robustness</h2>
|
<boost/detail/atomic_count.hpp></a>
|
||||||
|
file for details
|
||||||
<ul>
|
<li>
|
||||||
|
The new shared_ptr will always delete the object using the pointer it was
|
||||||
<li>The manipulation of use counts is now <a name="threadsafe">thread safe</a> on Windows, Linux, and platforms
|
originally constructed with. This prevents subtle problems that could happen if
|
||||||
that support pthreads. See the
|
the last <b>shared_ptr</b> was a pointer to a sub-object of a class that did
|
||||||
<a href="../../boost/detail/atomic_count.hpp"><boost/detail/atomic_count.hpp></a>
|
not have a virtual destructor.</li>
|
||||||
file for details</li>
|
</ul>
|
||||||
|
<h2>Implementation Details</h2>
|
||||||
<li>The new shared_ptr will always delete the object using the pointer it was originally constructed with.
|
<ul>
|
||||||
This prevents subtle problems that could happen if the last <b>shared_ptr</b> was a pointer to a sub-object
|
<li>
|
||||||
of a class that did not have a virtual destructor.</li>
|
Some bugs in the assignment operator implementations and in <b>reset</b>
|
||||||
|
have been fixed by using the "copy and swap" idiom.
|
||||||
</ul>
|
<li>
|
||||||
|
Assertions have been added to check preconditions of various functions;
|
||||||
<h2>Implementation Details</h2>
|
however, since these use the new <a href="../../boost/assert.hpp"><boost/assert.hpp></a>
|
||||||
|
header, the assertions are disabled by default.
|
||||||
<ul>
|
<li>
|
||||||
|
The partial specialization of <b>std::less</b> has been replaced by <b>operator<</b>
|
||||||
<li>Some bugs in the assignment operator implementations and in <b>reset</b>
|
overloads which accomplish the same thing without relying on undefined
|
||||||
have been fixed by using the "copy and swap" idiom.</li>
|
behavior.
|
||||||
|
<li>
|
||||||
<li>Assertions have been added to check preconditions of various functions;
|
The incorrect overload of <b>std::swap</b> has been replaced by <b>boost::swap</b>,
|
||||||
however, since these use the new
|
which has many of the same advantages for generic programming but does not
|
||||||
<a href="../../boost/assert.hpp"><boost/assert.hpp></a>
|
violate the C++ standard.</li>
|
||||||
header, the assertions are disabled by default.</li>
|
</ul>
|
||||||
|
<hr>
|
||||||
<li>The partial specialization of <b>std::less</b> has been replaced by <b>operator<</b>
|
<p>Revised 1 February 2002</p>
|
||||||
overloads which accomplish the same thing without relying on undefined behavior.</li>
|
<p>Copyright 2002 Darin Adler. Permission to copy, use, modify, sell and distribute
|
||||||
|
this document is granted provided this copyright notice appears in all copies.
|
||||||
<li>The incorrect overload of <b>std::swap</b> has been replaced by <b>boost::swap</b>, which
|
This document is provided "as is" without express or implied warranty, and with
|
||||||
has many of the same advantages for generic programming but does not violate the C++ standard.</li>
|
no claim as to its suitability for any purpose.</p>
|
||||||
|
</body>
|
||||||
</ul>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<p>Revised 1 February 2002</p>
|
|
||||||
|
|
||||||
<p>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.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,10 +7,9 @@
|
|||||||
<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
|
<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
|
||||||
<table border="0" width="100%">
|
<table border="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="277">
|
<td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A>
|
||||||
<img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86">
|
|
||||||
</td>
|
</td>
|
||||||
<td align="middle">
|
<td align="center">
|
||||||
<h1>enable_shared_from_this.hpp</h1>
|
<h1>enable_shared_from_this.hpp</h1>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body text="#000000" bgColor="#ffffff">
|
<body text="#000000" bgColor="#ffffff">
|
||||||
<h1><A href="../.."><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
<h1><A href="../../index.htm"><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
||||||
border="0"></A>intrusive_ptr class template</h1>
|
border="0"></A>intrusive_ptr class template</h1>
|
||||||
<p>
|
<p>
|
||||||
<A href="#Introduction">Introduction</A><br>
|
<A href="#Introduction">Introduction</A><br>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body text="#000000" bgColor="#ffffff">
|
<body text="#000000" bgColor="#ffffff">
|
||||||
<h1><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle">shared_ptr
|
<h1><A href="../../index.htm"><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
||||||
class template</h1>
|
border="0"></A>shared_ptr class template</h1>
|
||||||
<p><A href="#Introduction">Introduction</A><br>
|
<p><A href="#Introduction">Introduction</A><br>
|
||||||
<A href="#BestPractices">Best Practices</A><br>
|
<A href="#BestPractices">Best Practices</A><br>
|
||||||
<A href="#Synopsis">Synopsis</A><br>
|
<A href="#Synopsis">Synopsis</A><br>
|
||||||
@ -621,7 +621,7 @@ p3.reset(new int(2)); // undefined, multiple writes
|
|||||||
day a highly configurable smart pointer may be invented that is also very easy
|
day a highly configurable smart pointer may be invented that is also very easy
|
||||||
to use and very hard to misuse. Until then, <B>shared_ptr</B> is the smart
|
to use and very hard to misuse. Until then, <B>shared_ptr</B> is the smart
|
||||||
pointer of choice for a wide range of applications. (Those interested in policy
|
pointer of choice for a wide range of applications. (Those interested in policy
|
||||||
based smart pointers should read <A href="http://www.awprofessional.com/bookstore/product.asp?isbn=0201704315&rl=1">
|
based smart pointers should read <A href="http://www.awprofessional.com/bookstore/product.asp?isbn=0201704315&rl=1">
|
||||||
Modern C++ Design</A> by Andrei Alexandrescu.)<BR>
|
Modern C++ Design</A> by Andrei Alexandrescu.)<BR>
|
||||||
</P>
|
</P>
|
||||||
<P><B>Q.</B> I am not convinced. Default parameters can be used where appropriate
|
<P><B>Q.</B> I am not convinced. Default parameters can be used where appropriate
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body bgcolor="#ffffff" text="#000000">
|
<body bgcolor="#ffffff" text="#000000">
|
||||||
<h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86">Smart
|
<h1><A href="../../index.htm"><img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86"
|
||||||
Pointers</h1>
|
border="0"></A>Smart Pointers</h1>
|
||||||
<p><a href="#Introduction">Introduction</a><br>
|
<p><a href="#Introduction">Introduction</a><br>
|
||||||
<a href="#common_requirements">Common Requirements</a><br>
|
<a href="#common_requirements">Common Requirements</a><br>
|
||||||
<a href="#Exception_Safety">Exception Safety</a><br>
|
<a href="#Exception_Safety">Exception Safety</a><br>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body text="#000000" bgColor="#ffffff">
|
<body text="#000000" bgColor="#ffffff">
|
||||||
<h1><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle">Smart
|
<h1><A href="../../index.htm"><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
||||||
Pointer Programming Techniques</h1>
|
border="0"></A>Smart Pointer Programming Techniques</h1>
|
||||||
<p><A href="#incomplete">Using incomplete classes for implementation hiding</A><br>
|
<p><A href="#incomplete">Using incomplete classes for implementation hiding</A><br>
|
||||||
<A href="#pimpl">The "Pimpl" idiom</A><br>
|
<A href="#pimpl">The "Pimpl" idiom</A><br>
|
||||||
<A href="#abstract">Using abstract classes for implementation hiding</A><br>
|
<A href="#abstract">Using abstract classes for implementation hiding</A><br>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body text="#000000" bgColor="#ffffff">
|
<body text="#000000" bgColor="#ffffff">
|
||||||
<h1><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle">weak_ptr
|
<h1><A href="../../index.htm"><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
||||||
class template</h1>
|
border="0"></A>weak_ptr class template</h1>
|
||||||
<p><A href="#Introduction">Introduction</A><br>
|
<p><A href="#Introduction">Introduction</A><br>
|
||||||
<A href="#Synopsis">Synopsis</A><br>
|
<A href="#Synopsis">Synopsis</A><br>
|
||||||
<A href="#Members">Members</A><br>
|
<A href="#Members">Members</A><br>
|
||||||
|
Reference in New Issue
Block a user