forked from boostorg/smart_ptr
Fixed broken links.
[SVN r17044]
This commit is contained in:
88
index.htm
88
index.htm
@ -1,47 +1,47 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Boost Smart Pointer Library</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
<table border="1" bgcolor="#007F7F" cellpadding="2">
|
||||
<tr>
|
||||
<td bgcolor="#FFFFFF"><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td>
|
||||
<td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home</big></font></a></td>
|
||||
<td><a href="../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries</big></font></a></td>
|
||||
<td><a href="../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People</big></font></a></td>
|
||||
<td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1>Smart Pointer Library</h1>
|
||||
<p>The smart pointer library includes five smart pointer class templates. Smart
|
||||
pointers ease the management of memory dynamically allocated with C++ <b>new</b>
|
||||
expressions. In addition, <b>scoped_ptr</b> can ease the management of memory
|
||||
dynamically allocated in other ways.</p>
|
||||
<ul>
|
||||
<li><a href="smart_ptr.htm">Documentation</a> (HTML).</li>
|
||||
<li>Header <a href="../../boost/scoped_ptr.hpp">scoped_ptr.hpp</a>.</li>
|
||||
<li>Header <a href="../../boost/scoped_array.hpp">scoped_array.hpp</a>.</li>
|
||||
<li>Header <a href="../../boost/shared_ptr.hpp">shared_ptr.hpp</a>.</li>
|
||||
<li>Header <a href="../../boost/shared_array.hpp">shared_array.hpp</a>.</li>
|
||||
<li>Header <a href="../../boost/weak_ptr.hpp">weak_ptr.hpp</a>.</li>
|
||||
<li>Test program <a href="smart_ptr_test.cpp">smart_ptr_test.cpp</a>.</li>
|
||||
<li>Originally submitted by
|
||||
<a href="../../people/greg_colvin.htm">Greg Colvin</a> and
|
||||
<a href="../../people/beman_dawes.html">Beman Dawes</a>,
|
||||
currently maintained by
|
||||
<a href="../../people/peter_dimov.htm">Peter Dimov</a> and
|
||||
<a href="../../people/darin_adler.htm">Darin Adler</a>.</li>
|
||||
</ul>
|
||||
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan -->1 February 2002<!--webbot bot="Timestamp" endspan i-checksum="14885" -->.</p>
|
||||
|
||||
</body>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Boost Smart Pointer Library</title>
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
<table border="1" bgcolor="#007F7F" cellpadding="2">
|
||||
<tr>
|
||||
<td bgcolor="#FFFFFF"><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td>
|
||||
<td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home</big></font></a></td>
|
||||
<td><a href="../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries</big></font></a></td>
|
||||
<td><a href="../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People</big></font></a></td>
|
||||
<td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1>Smart Pointer Library</h1>
|
||||
<p>The smart pointer library includes five smart pointer class templates. Smart
|
||||
pointers ease the management of memory dynamically allocated with C++ <b>new</b>
|
||||
expressions. In addition, <b>scoped_ptr</b> can ease the management of memory
|
||||
dynamically allocated in other ways.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="smart_ptr.htm">Documentation</a> (HTML).</li>
|
||||
<li>
|
||||
Header <a href="../../boost/scoped_ptr.hpp">scoped_ptr.hpp</a>.</li>
|
||||
<li>
|
||||
Header <a href="../../boost/scoped_array.hpp">scoped_array.hpp</a>.</li>
|
||||
<li>
|
||||
Header <a href="../../boost/shared_ptr.hpp">shared_ptr.hpp</a>.</li>
|
||||
<li>
|
||||
Header <a href="../../boost/shared_array.hpp">shared_array.hpp</a>.</li>
|
||||
<li>
|
||||
Header <a href="../../boost/weak_ptr.hpp">weak_ptr.hpp</a>.</li>
|
||||
<li>
|
||||
Test program <a href="test/smart_ptr_test.cpp">smart_ptr_test.cpp</a>.</li>
|
||||
<li>
|
||||
Originally submitted by <a href="../../people/greg_colvin.htm">Greg Colvin</a> and
|
||||
<a href="../../people/beman_dawes.html">Beman Dawes</a>, currently maintained
|
||||
by <a href="../../people/peter_dimov.htm">Peter Dimov</a> and <a href="../../people/darin_adler.htm">
|
||||
Darin Adler</a>.</li>
|
||||
</ul>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan -->
|
||||
1 February 2002<!--webbot bot="Timestamp" endspan i-checksum="14885" --> .</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -14,10 +14,9 @@
|
||||
<p>The <b>scoped_ptr</b> template is a simple solution for simple needs. It
|
||||
supplies a basic "resource acquisition is initialization" facility, without
|
||||
shared-ownership or transfer-of-ownership semantics. Both its name and
|
||||
enforcement of semantics (by being
|
||||
<a href="../utility/utility.htm#Class_noncopyable">noncopyable</a>) signal its intent to retain ownership solely within the
|
||||
current scope. Because it is
|
||||
<a href="../utility/utility.htm#Class_noncopyable">noncopyable</a>,
|
||||
enforcement of semantics (by being <a href="../utility/utility.htm#Class_noncopyable">
|
||||
noncopyable</a>) signal its intent to retain ownership solely within the
|
||||
current scope. Because it is <a href="../utility/utility.htm#Class_noncopyable">noncopyable</a>,
|
||||
it is safer than <b>shared_ptr</b> or <b>std::auto_ptr</b> for pointers which
|
||||
should not be copied.</p>
|
||||
<p>Because <b>scoped_ptr</b> is simple, in its usual implementation every operation
|
||||
@ -151,12 +150,12 @@ Buckle my shoe</pre>
|
||||
<p>One common usage of <b>scoped_ptr</b> is to implement a handle/body (also called
|
||||
pimpl) idiom which avoids exposing the body (implementation) in the header
|
||||
file.</p>
|
||||
<p>The <a href="scoped_ptr_example_test.cpp">scoped_ptr_example_test.cpp</a> sample
|
||||
program includes a header file, <a href="scoped_ptr_example.hpp">scoped_ptr_example.hpp</a>,
|
||||
<p>The <a href="example/scoped_ptr_example_test.cpp">scoped_ptr_example_test.cpp</a> sample
|
||||
program includes a header file, <a href="example/scoped_ptr_example.hpp">scoped_ptr_example.hpp</a>,
|
||||
which uses a <b>scoped_ptr<></b> to an incomplete type to hide the
|
||||
implementation. The instantiation of member functions which require a complete
|
||||
type occurs in the <a href="scoped_ptr_example.cpp">scoped_ptr_example.cpp</a> implementation
|
||||
file.</p>
|
||||
type occurs in the <a href="example/scoped_ptr_example.cpp">scoped_ptr_example.cpp</a>
|
||||
implementation file.</p>
|
||||
<h2>Frequently Asked Questions</h2>
|
||||
<p><b>Q</b>. Why doesn't <b>scoped_ptr</b> have a release() member?<br>
|
||||
<b>A</b>. When reading source code, it is valuable to be able to draw
|
||||
@ -166,11 +165,12 @@ Buckle my shoe</pre>
|
||||
given context. Use <STRONG>std::auto_ptr</STRONG> where transfer of ownership
|
||||
is required. (supplied by Dave Abrahams)</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan -->09 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32310" --></p>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan -->
|
||||
09 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32310" --></p>
|
||||
<p>Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler.
|
||||
Copyright 2002 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.</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -26,8 +26,8 @@
|
||||
<p>A <b>shared_ptr</b> to a <b>std::vector</b> is an alternative to a <b>shared_array</b>
|
||||
that is a bit heavier duty but far more flexible.</p>
|
||||
<p>The class template is parameterized on <b>T</b>, the type of the object pointed
|
||||
to. <b>T</b> must meet the smart pointer
|
||||
<a href="smart_ptr.htm#common_requirements">common requirements</a>.</p>
|
||||
to. <b>T</b> must meet the smart pointer <a href="smart_ptr.htm#common_requirements">
|
||||
common requirements</a>.</p>
|
||||
<h2>Synopsis</h2>
|
||||
<pre>namespace boost {
|
||||
|
||||
@ -98,8 +98,8 @@
|
||||
The guarantee that this does not throw exceptions depends on the requirement
|
||||
that the deleted object's destructor does not throw exceptions. See the smart
|
||||
pointer <a href="smart_ptr.htm#common_requirements">common requirements</a>.</p>
|
||||
<h3><a name="operator=">assignment</a></h3>
|
||||
<pre>shared_array & <a href="#assignment">operator=</a>(shared_array const & r); // never throws</pre>
|
||||
<h3><a name="assignment">assignment</a></h3>
|
||||
<pre>shared_array & operator=(shared_array const & r); // never throws</pre>
|
||||
<p>Constructs a new <b>shared_array</b> as described <a href="#constructors">above</a>,
|
||||
then replaces this <b>shared_array</b> with the new one, destroying the
|
||||
replaced object.</p>
|
||||
@ -115,7 +115,7 @@
|
||||
replaced object. <b>D</b>'s copy constructor must not throw. The only exception
|
||||
which may be thrown is <b>std::bad_alloc</b>. If an exception is thrown, <b>d(p)</b>
|
||||
is called.</p>
|
||||
<h3><a name="indirection">indexing</a></h3>
|
||||
<h3><a name="indexing">indexing</a></h3>
|
||||
<pre>T & operator[](std::ptrdiff_t i) const; // never throws</pre>
|
||||
<p>Returns a reference to element <b>i</b> of the array pointed to by the stored
|
||||
pointer. Behavior is undefined and almost certainly undesirable if the stored
|
||||
@ -169,11 +169,12 @@ template<class T>
|
||||
Provided as an aid to generic programming.</p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->09 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32310" --></p>
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->
|
||||
09 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32310" --></p>
|
||||
<p>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.</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -361,9 +361,9 @@ q = p;
|
||||
<h3><a name="use_count">use_count</a></h3>
|
||||
<pre>long use_count() const; // never throws</pre>
|
||||
<blockquote>
|
||||
<p><b>Returns:</b> the number of <b>shared_ptr</b> objects, <STRONG>*this</STRONG> included, that
|
||||
<i>share ownership</i> with <b>*this</b>, or an unspecified nonnegative value
|
||||
when <STRONG>*this</STRONG> is <EM>empty</EM>.</p>
|
||||
<p><b>Returns:</b> the number of <b>shared_ptr</b> objects, <STRONG>*this</STRONG> included,
|
||||
that <i>share ownership</i> with <b>*this</b>, or an unspecified nonnegative
|
||||
value when <STRONG>*this</STRONG> is <EM>empty</EM>.</p>
|
||||
<p><b>Throws:</b> nothing.</p>
|
||||
<P><B>Notes:</B> <code>use_count()</code> is not necessarily efficient. Use only
|
||||
for debugging and testing purposes, not for production code.</P>
|
||||
@ -490,9 +490,9 @@ q = p;
|
||||
<P><B>Returns:</B> <b>os</b>.</P>
|
||||
</BLOCKQUOTE>
|
||||
<h2><a name="example">Example</a></h2>
|
||||
<p>See <A href="shared_ptr_example.cpp">shared_ptr_example.cpp</A> for a complete
|
||||
example program. The program builds a <b>std::vector</b> and <b>std::set</b> of <b>shared_ptr</b>
|
||||
objects.</p>
|
||||
<p>See <A href="example/shared_ptr_example.cpp">shared_ptr_example.cpp</A> for a
|
||||
complete example program. The program builds a <b>std::vector</b> and <b>std::set</b>
|
||||
of <b>shared_ptr</b> objects.</p>
|
||||
<p>Note that after the containers have been populated, some of the <b>shared_ptr</b>
|
||||
objects will have a use count of 1 rather than a use count of 2, since the set
|
||||
is a <b>std::set</b> rather than a <b>std::multiset</b>, and thus does not
|
||||
@ -505,11 +505,11 @@ q = p;
|
||||
<p>One common usage of <b>shared_ptr</b> is to implement a handle/body (also called
|
||||
pimpl) idiom which avoids exposing the body (implementation) in the header
|
||||
file.</p>
|
||||
<p>The <A href="shared_ptr_example2_test.cpp">shared_ptr_example2_test.cpp</A> sample
|
||||
program includes a header file, <A href="shared_ptr_example2.hpp">shared_ptr_example2.hpp</A>,
|
||||
<p>The <A href="example/shared_ptr_example2_test.cpp">shared_ptr_example2_test.cpp</A>
|
||||
sample program includes a header file, <A href="example/shared_ptr_example2.hpp">shared_ptr_example2.hpp</A>,
|
||||
which uses a <b>shared_ptr<></b> to an incomplete type to hide the
|
||||
implementation. The instantiation of member functions which require a complete
|
||||
type occurs in the <A href="shared_ptr_example2.cpp">shared_ptr_example2.cpp</A>
|
||||
type occurs in the <A href="example/shared_ptr_example2.cpp">shared_ptr_example2.cpp</A>
|
||||
implementation file. Note that there is no need for an explicit destructor.
|
||||
Unlike ~scoped_ptr, ~shared_ptr does not require that <b>T</b> be a complete
|
||||
type.</p>
|
||||
|
@ -8,11 +8,11 @@
|
||||
<h1><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" align="middle" width="277" height="86">Smart
|
||||
Pointers</h1>
|
||||
<p><a href="#Introduction">Introduction</a><br>
|
||||
<a href="#common_requirements">Common Requirements</a><br>
|
||||
<a href="#Exception_Safety">Exception Safety</a><br>
|
||||
<a href="#Exception-specifications">Exception-specifications</a><br>
|
||||
<a href="#History">History and Acknowledgements</a><br>
|
||||
<a href="#References">References</a></p>
|
||||
<a href="#common_requirements">Common Requirements</a><br>
|
||||
<a href="#Exception_Safety">Exception Safety</a><br>
|
||||
<a href="#Exception-specifications">Exception-specifications</a><br>
|
||||
<a href="#History">History and Acknowledgements</a><br>
|
||||
<a href="#References">References</a></p>
|
||||
<h2><a name="Introduction">Introduction</a></h2>
|
||||
<p>Smart pointers are objects which store pointers to dynamically allocated (heap)
|
||||
objects. They behave much like built-in C++ pointers except that they
|
||||
@ -56,7 +56,7 @@
|
||||
<p>They are examples of the "resource acquisition is initialization" idiom
|
||||
described in Bjarne Stroustrup's "The C++ Programming Language", 3rd edition,
|
||||
Section 14.4, Resource Management.</p>
|
||||
<p>A test program, <a href="smart_ptr_test.cpp">smart_ptr_test.cpp</a>, is provided
|
||||
<p>A test program, <a href="test/smart_ptr_test.cpp">smart_ptr_test.cpp</a>, is provided
|
||||
to verify correct operation.</p>
|
||||
<p>A page on <a href="compatibility.htm">compatibility</a> with older versions of
|
||||
the Boost smart pointer library describes some of the changes since earlier
|
||||
@ -121,11 +121,11 @@
|
||||
<p>September 1999. Luis Coelho provided <b>shared_ptr::swap</b> and <b>shared_array::swap</b></p>
|
||||
<p>May 1999. In April and May, 1999, Valentin Bonnard and David Abrahams made a
|
||||
number of suggestions resulting in numerous improvements.</p>
|
||||
<p>October 1998. Beman Dawes proposed reviving the original semantics under the names <b>safe_ptr</b>
|
||||
and <b>counted_ptr</b>, meeting of Per Andersson, Matt
|
||||
<p>October 1998. Beman Dawes proposed reviving the original semantics under the
|
||||
names <b>safe_ptr</b> and <b>counted_ptr</b>, meeting of Per Andersson, Matt
|
||||
Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis, Dietmar K<>hl,
|
||||
Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four
|
||||
new class names were finalized, it was decided that there was no need to exactly
|
||||
Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four new
|
||||
class names were finalized, it was decided that there was no need to exactly
|
||||
follow the <b>std::auto_ptr</b> interface, and various function signatures and
|
||||
semantics were finalized.</p>
|
||||
<p>Over the next three months, several implementations were considered for <b>shared_ptr</b>,
|
||||
@ -154,26 +154,24 @@
|
||||
experimented with.</p>
|
||||
<p>But Greg Colvin and Jerry Schwarz argued that "parameterization will discourage
|
||||
users", and in the end we choose to supply only the direct implementation.</p>
|
||||
<p>Summer, 1994. Greg Colvin proposed to the C++ Standards Committee
|
||||
classes named <b>auto_ptr</b> and <b>counted_ptr</b> which were very similar to
|
||||
what we now call <b>scoped_ptr</b> and <b>shared_ptr</b>.
|
||||
<a href="#Col-94">[Col-94]</a> In one of the very
|
||||
few cases where the Library Working Group's recommendations were not followed
|
||||
by the full committee, <b>counted_ptr</b> was rejected and surprising
|
||||
<p>Summer, 1994. Greg Colvin proposed to the C++ Standards Committee classes named <b>auto_ptr</b>
|
||||
and <b>counted_ptr</b> which were very similar to what we now call <b>scoped_ptr</b>
|
||||
and <b>shared_ptr</b>. <a href="#Col-94">[Col-94]</a> In one of the very few
|
||||
cases where the Library Working Group's recommendations were not followed by
|
||||
the full committee, <b>counted_ptr</b> was rejected and surprising
|
||||
transfer-of-ownership semantics were added to <b>auto_ptr</b>.</p>
|
||||
<h2><a name="References">References</a></h2>
|
||||
<p>[<a name="Col-94">Col-94</a>] Gregory Colvin,
|
||||
<a href="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/1994/N0555.pdf">
|
||||
Exception Safe Smart Pointers</a>, C++ committee document 94-168/N0555,
|
||||
July, 1994.</p>
|
||||
<p>[<a name="E&D-94">E&D-94</a>] John R. Ellis & David L. Detlefs,
|
||||
<a href="http://www.usenix.org/publications/library/proceedings/c++94/full_papers/ellis.a">
|
||||
Safe, Efficient Garbage Collection for C++</a>, Usenix Proceedings,
|
||||
February, 1994. This paper includes an extensive discussion of weak
|
||||
pointers and an extensive bibliography.</p>
|
||||
<p>[<a name="Col-94">Col-94</a>] Gregory Colvin, <a href="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/1994/N0555.pdf">
|
||||
Exception Safe Smart Pointers</a>, C++ committee document 94-168/N0555,
|
||||
July, 1994.</p>
|
||||
<p>[<a name="E&D-94">E&D-94</a>] John R. Ellis & David L. Detlefs, <a href="http://www.usenix.org/publications/library/proceedings/c++94/full_papers/ellis.a">
|
||||
Safe, Efficient Garbage Collection for C++</a>, Usenix Proceedings,
|
||||
February, 1994. This paper includes an extensive discussion of weak pointers
|
||||
and an extensive bibliography.</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B %Y" startspan
|
||||
-->15 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32303"
|
||||
-->
|
||||
15 January 2003<!--webbot bot="Timestamp" endspan i-checksum="32303"
|
||||
--></p>
|
||||
<p>Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler.
|
||||
Permission to copy, use, modify, sell and distribute this document is granted
|
||||
@ -181,4 +179,4 @@
|
||||
"as is" without express or implied warranty, and with no claim as to its
|
||||
suitability for any purpose.</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user