Merge pull request #17 from cstratopoulos/feature/auto_ptr-deprecate-doc-update

Update docs for Boost 1.67 treatment of deprecated auto_ptr
This commit is contained in:
Edward Diener
2018-04-09 08:53:06 -04:00
committed by GitHub
44 changed files with 3357 additions and 1575 deletions

View File

@@ -33,5 +33,6 @@ sh comp_ptr_multimap.sh
sh comp_ptr_set.sh
sh comp_ptr_multiset.sh
sh comp_indirect_fun.sh
sh comp_compatible_smart_ptr.sh

View File

@@ -0,0 +1,13 @@
#//
#// Boost.Pointer Container
#//
#// Copyright Thorsten Ottosen 2003-2005. Use, modification and
#// distribution is subject to 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)
#//
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py compatible_smart_ptr.rst > compatible_smart_ptr.html

View File

@@ -9,4 +9,5 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py conventions.rst > conventions.html
rst2html.py conventions.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > conventions.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_array.rst > ptr_array.html
rst2html.py ptr_array.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_array.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_deque.rst > ptr_deque.html
rst2html.py ptr_deque.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_deque.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_list.rst > ptr_list.html
rst2html.py ptr_list.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_list.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_map_adapter.rst > ptr_map_adapter.html
rst2html.py ptr_map_adapter.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_map_adapter.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_multimap_adapter.rst > ptr_multimap_adapter.html
rst2html.py ptr_multimap_adapter.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_multimap_adapter.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_multiset_adapter.rst > ptr_multiset_adapter.html
rst2html.py ptr_multiset_adapter.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_multiset_adapter.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_sequence_adapter.rst > ptr_sequence_adapter.html
rst2html.py ptr_sequence_adapter.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_sequence_adapter.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_set_adapter.rst > ptr_set_adapter.html
rst2html.py ptr_set_adapter.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_set_adapter.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py ptr_vector.rst > ptr_vector.html
rst2html.py ptr_vector.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > ptr_vector.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py reversible_ptr_container.rst > reversible_ptr_container.html
rst2html.py reversible_ptr_container.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > reversible_ptr_container.html

View File

@@ -9,5 +9,6 @@
#// For more information, see http://www.boost.org/libs/ptr_container/
#//
rst2html.py tutorial.rst > tutorial.html
rst2html.py tutorial.rst |
sed 's@compatible-smart-ptr@<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>@g' > tutorial.html

View File

@@ -0,0 +1,478 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<h2 class="subtitle" id="compatible-smart-pointer-type">Compatible Smart Pointer Type</h2>
<p>When specifying parameter or return types in interfaces, the documentation
for this library uses the pseudo-type</p>
<pre class="literal-block">
<em>compatible-smart-ptr</em>&lt;T&gt;
</pre>
<p>to indicate that the compiler C++ standard is being used to
selectively provide or remove interfaces with <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt> or
<tt class="docutils literal"><span class="pre">std::unique_ptr&lt;T&gt;</span></tt>. The exact meaning varies depending on whether
the smart pointer type is a parameter or a return type.</p>
<p><strong>Parameter Types:</strong></p>
<p>An interface such as</p>
<pre class="literal-block">
void container::push_back( <em>compatible-smart-ptr</em>&lt;T&gt; );
</pre>
<p>indicates that an overload of <tt class="docutils literal"><span class="pre">container::push_back</span></tt> is present for
one or both of <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt>, <tt class="docutils literal"><span class="pre">std::unique_ptr&lt;T&gt;</span></tt>;
Boost.Pointer Container provides an overload for each type supported
by the compiler. To be completely explicit, if the compiler provides
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>, then</p>
<pre class="literal-block">
void container::push_back( std::auto_ptr&lt;T&gt; );
</pre>
<p>is present. If the compiler provides <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>, then</p>
<pre class="literal-block">
void container::push_back( std::unique_ptr&lt;T&gt; );
</pre>
<p>is present. And if the compiler provides both, both overloads are
present.</p>
<p>In practice this means that C++98/03 users have access to
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> overloads, C++11/14 users have access to
overloads taking both <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> and <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>, and
users of C++17 and onwards only have access to <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>
overloads.</p>
<p>The convention outlined above implies that in certain cases the
documentation will make reference to a single function taking the
compatible smart pointer pseudo parameter, when in fact two distinct
overloaded functions are present. Of course the actual interface
depends on compiler settings, so for clarity the <a class="reference external" href="reversible_ptr_container.html">class hierarchy
reference</a> will only ever refer to a
single function.</p>
<p><strong>Return Types:</strong></p>
<p>The case of return types is handled along the same lines as parameter
types, subject of course to the restriction that C++ functions cannot
be overloaded by return type. Thus, an interface such as</p>
<pre class="literal-block">
<em>compatible-smart-ptr</em>&lt;T&gt; container::release( );
</pre>
<p>means that precisely one of <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt> or
<tt class="docutils literal"><span class="pre">std::unique_ptr&lt;T&gt;</span></tt> is used as the return type. If the compiler
provides <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt>, then</p>
<pre class="literal-block">
std::auto_ptr&lt;T&gt; container::release( );
</pre>
<p>is present, even if the compiler provides <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>. For
compilers that only provide <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>, the interface above
becomes</p>
<pre class="literal-block">
std::unique_ptr&lt;T&gt; container::release( );
</pre>
<p>In practice, this means that for users of C++98/03/11/14, such return
types are always <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>; for users of C++17 and onwards the
return type is <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>.</p>
<p><strong>Details:</strong></p>
<p>The ISO C++11 standard saw the addition of the smart pointer class template
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>, and with it the formal deprecation of
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>. After spending C++11 and C++14 with deprecated
status, <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> has been formally removed as of
the ISO C++17 standard. As such, headers mentioning
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> may be unusable in standard library
implementations which disable <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> when C++17 or later
is used. Boost.Pointer Container predates the existence of
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>, and since Boost v. <tt class="docutils literal">1.34</tt> it has provided
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> overloads for its interfaces. To provide
compatibility across a range of C++ standards, macros are used for
compile-time overloading or replacement of <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> interfaces with
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> interfaces.</p>
<p><a class="reference external" href="../../config/index.html">Boost.Config</a> defines the macro
<tt class="docutils literal">BOOST_NO_CXX11_SMART_PTR</tt> for compilers where
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> is not available, and <tt class="docutils literal">BOOST_NO_AUTO_PTR</tt> for
compilers where <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> is removed (or is defective). These
macros are used for compile-time selection of interfaces depending on
parameter and return type. For interfaces that take smart pointer
parameters, Boost.Pointer Container uses <tt class="docutils literal">BOOST_NO_AUTO_PTR</tt> and
<tt class="docutils literal">BOOST_NO_CXX11_SMART_PTR</tt> independently of each other to provide
interfaces taking one or both of <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>,
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> as parameters. For interfaces with smart pointer
return types, the Boost.Config macros are used first to check if
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> is available, providing <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> as the
return type only for compilers that provide <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> but
not <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>.</p>
<p>Thus, all mentions of</p>
<pre class="literal-block">
<em>compatible-smart-ptr</em>&lt;T&gt;
</pre>
<p>shall be understood to mean that <a class="reference external" href="../../config/index.html">Boost.Config</a> has been used as outlined above to provide
a smart pointer interface that is compatible with compiler settings.</p>
<p><strong>Navigate</strong></p>
<ul class="simple">
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<hr><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

View File

@@ -0,0 +1,138 @@
++++++++++++++++++++++++++++++++++
|Boost| Pointer Container Library
++++++++++++++++++++++++++++++++++
.. |Boost| image:: boost.png
Compatible Smart Pointer Type
-----------------------------
When specifying parameter or return types in interfaces, the documentation
for this library uses the pseudo-type
.. parsed-literal::
*compatible-smart-ptr*\ <T>
to indicate that the compiler C++ standard is being used to
selectively provide or remove interfaces with ``std::auto_ptr<T>`` or
``std::unique_ptr<T>``. The exact meaning varies depending on whether
the smart pointer type is a parameter or a return type.
**Parameter Types:**
An interface such as
.. parsed-literal::
void container::push_back( *compatible-smart-ptr*\ <T> );
indicates that an overload of ``container::push_back`` is present for
one or both of ``std::auto_ptr<T>``, ``std::unique_ptr<T>``:
Boost.Pointer Container provides an overload for each type supported
by the compiler. To be completely explicit, if the compiler provides
``std::auto_ptr``, then
.. parsed-literal::
void container::push_back( std::auto_ptr<T> );
is present. If the compiler provides ``std::unique_ptr``, then
.. parsed-literal::
void container::push_back( std::unique_ptr<T> );
is present. And if the compiler provides both, both overloads are
present.
In practice this means that C++98/03 users have access to
``std::auto_ptr`` overloads, C++11/14 users have access to
overloads taking both ``std::auto_ptr`` and ``std::unique_ptr``, and
users of C++17 and onwards only have access to ``std::unique_ptr``
overloads.
The convention outlined above implies that in certain cases the
documentation will make reference to a single function taking the
compatible smart pointer pseudo parameter, when in fact two distinct
overloaded functions are present. Of course the actual interface
depends on compiler settings, so for clarity the `class hierarchy
reference <reversible_ptr_container.html>`_ will only ever refer to a
single function.
**Return Types:**
The case of return types is handled along the same lines as parameter
types, subject of course to the restriction that C++ functions cannot
be overloaded by return type. Thus, an interface such as
.. parsed-literal::
*compatible-smart-ptr*\ <T> container::release( );
means that precisely one of ``std::auto_ptr<T>`` or
``std::unique_ptr<T>`` is used as the return type. If the compiler
provides ``std::auto_ptr<T>``, then
.. parsed-literal::
std::auto_ptr<T> container::release( );
is present, even if the compiler provides ``std::unique_ptr``. For
compilers that only provide ``std::unique_ptr``, the interface above
becomes
.. parsed-literal::
std::unique_ptr<T> container::release( );
In practice, this means that for users of C++98/03/11/14, such return
types are always ``std::auto_ptr``; for users of C++17 and onwards the
return type is ``std::unique_ptr``.
**Details:**
The ISO C++11 standard saw the addition of the smart pointer class template
``std::unique_ptr``, and with it the formal deprecation of
``std::auto_ptr``. After spending C++11 and C++14 with deprecated
status, ``std::auto_ptr`` has been formally removed as of
the ISO C++17 standard. As such, headers mentioning
``std::auto_ptr`` may be unusable in standard library
implementations which disable ``std::auto_ptr`` when C++17 or later
is used. Boost.Pointer Container predates the existence of
``std::unique_ptr``, and since Boost v. ``1.34`` it has provided
``std::auto_ptr`` overloads for its interfaces. To provide
compatibility across a range of C++ standards, macros are used for
compile-time overloading or replacement of ``std::auto_ptr`` interfaces with
``std::unique_ptr`` interfaces.
`Boost.Config <../../config/index.html>`_ defines the macro
``BOOST_NO_CXX11_SMART_PTR`` for compilers where
``std::unique_ptr`` is not available, and ``BOOST_NO_AUTO_PTR`` for
compilers where ``std::auto_ptr`` is removed (or is defective). These
macros are used for compile-time selection of interfaces depending on
parameter and return type. For interfaces that take smart pointer
parameters, Boost.Pointer Container uses ``BOOST_NO_AUTO_PTR`` and
``BOOST_NO_CXX11_SMART_PTR`` independently of each other to provide
interfaces taking one or both of ``std::auto_ptr``,
``std::unique_ptr`` as parameters. For interfaces with smart pointer
return types, the Boost.Config macros are used first to check if
``std::auto_ptr`` is available, providing ``std::unique_ptr`` as the
return type only for compilers that provide ``std::unique_ptr`` but
not ``std::auto_ptr``.
Thus, all mentions of
.. parsed-literal::
*compatible-smart-ptr*\ <T>
shall be understood to mean that `Boost.Config
<../../config/index.html>`_ has been used as outlined above to provide
a smart pointer interface that is compatible with compiler settings.
**Navigate**
- `home <ptr_container.html>`_
- `reference <reference.html>`_
.. raw:: html
<hr>
:Copyright: Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__).
__ http://www.boost.org/LICENSE_1_0.txt

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -290,94 +363,95 @@ ul.auto-toc {
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<h2 class="subtitle" id="conventions">Conventions</h2>
<p>There are a few design decisions that will affect how the classes are
used. Besides these the classes are much like normal standard containers
<p>There are a few design decisions that will affect how the classes are
used. Besides these the classes are much like normal standard containers
and provides almost the same interface. The new conventions are:</p>
<div class="contents local topic">
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference" href="#null-pointers-are-not-allowed-by-default" id="id3" name="id3">Null pointers are not allowed by default</a></li>
<li><a class="reference" href="#all-default-iterators-apply-an-extra-layer-of-indirection" id="id4" name="id4">All default iterators apply an extra layer of indirection</a></li>
<li><a class="reference" href="#all-comparison-operations-are-done-on-the-pointed-to-objects-and-not-at-the-pointer-level" id="id5" name="id5">All comparison operations are done on the pointed to objects and not at the pointer level</a></li>
<li><a class="reference" href="#stored-elements-are-required-to-be-cloneable-for-a-subset-of-the-operations" id="id6" name="id6">Stored elements are required to be Cloneable for a subset of the operations</a></li>
<li><a class="reference" href="#whenever-objects-are-inserted-into-a-container-they-are-cloned-before-insertion" id="id7" name="id7">Whenever objects are inserted into a container, they are cloned before insertion</a></li>
<li><a class="reference" href="#whenever-pointers-are-inserted-into-a-container-ownership-is-transferred-to-the-container" id="id8" name="id8">Whenever pointers are inserted into a container, ownership is transferred to the container</a></li>
<li><a class="reference" href="#ownership-can-be-transferred-from-a-container-on-a-per-pointer-basis" id="id9" name="id9">Ownership can be transferred from a container on a per pointer basis</a></li>
<li><a class="reference" href="#ownership-can-be-transferred-from-a-container-to-another-container-on-a-per-iterator-range-basis" id="id10" name="id10">Ownership can be transferred from a container to another container on a per iterator range basis</a></li>
<li><a class="reference" href="#a-container-can-be-cheaply-returned-from-functions-either-by-making-a-clone-or-by-giving-up-ownership-of-the-container" id="id11" name="id11">A container can be cheaply returned from functions either by making a clone or by giving up ownership of the container</a></li>
<li><a class="reference" href="#iterators-are-invalidated-as-in-the-corresponding-standard-container" id="id12" name="id12">Iterators are invalidated as in the corresponding standard container</a></li>
<li><a class="reference internal" href="#null-pointers-are-not-allowed-by-default" id="id3">Null pointers are not allowed by default</a></li>
<li><a class="reference internal" href="#all-default-iterators-apply-an-extra-layer-of-indirection" id="id4">All default iterators apply an extra layer of indirection</a></li>
<li><a class="reference internal" href="#all-comparison-operations-are-done-on-the-pointed-to-objects-and-not-at-the-pointer-level" id="id5">All comparison operations are done on the pointed to objects and not at the pointer level</a></li>
<li><a class="reference internal" href="#stored-elements-are-required-to-be-cloneable-for-a-subset-of-the-operations" id="id6">Stored elements are required to be Cloneable for a subset of the operations</a></li>
<li><a class="reference internal" href="#whenever-objects-are-inserted-into-a-container-they-are-cloned-before-insertion" id="id7">Whenever objects are inserted into a container, they are cloned before insertion</a></li>
<li><a class="reference internal" href="#whenever-pointers-are-inserted-into-a-container-ownership-is-transferred-to-the-container" id="id8">Whenever pointers are inserted into a container, ownership is transferred to the container</a></li>
<li><a class="reference internal" href="#ownership-can-be-transferred-from-a-container-on-a-per-pointer-basis" id="id9">Ownership can be transferred from a container on a per pointer basis</a></li>
<li><a class="reference internal" href="#ownership-can-be-transferred-from-a-container-to-another-container-on-a-per-iterator-range-basis" id="id10">Ownership can be transferred from a container to another container on a per iterator range basis</a></li>
<li><a class="reference internal" href="#a-container-can-be-cheaply-returned-from-functions-either-by-making-a-clone-or-by-giving-up-ownership-of-the-container" id="id11">A container can be cheaply returned from functions either by making a clone or by giving up ownership of the container</a></li>
<li><a class="reference internal" href="#iterators-are-invalidated-as-in-the-corresponding-standard-container" id="id12">Iterators are invalidated as in the corresponding standard container</a></li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id3" id="null-pointers-are-not-allowed-by-default" name="null-pointers-are-not-allowed-by-default">Null pointers are not allowed by default</a></h1>
<p>If the user tries to insert the null pointer, the operation will throw a
<tt class="docutils literal"><span class="pre">bad_pointer</span></tt> exception (see <a class="reference" href="examples.html">Example 1</a>).</p>
<p>Use <a class="reference" href="reference.html#class-nullable">nullable</a> to allow null pointers.</p>
<div class="section" id="null-pointers-are-not-allowed-by-default">
<h1><a class="toc-backref" href="#id3">Null pointers are not allowed by default</a></h1>
<p>If the user tries to insert the null pointer, the operation will throw a
<tt class="docutils literal">bad_pointer</tt> exception (see <a class="reference external" href="examples.html">Example 1</a>).</p>
<p>Use <a class="reference external" href="reference.html#class-nullable">nullable</a> to allow null pointers.</p>
<p>Please notice that all preconditions of the form</p>
<pre class="literal-block">
x != 0;
</pre>
<p>are not active when the you have instantiated a container
with <tt class="docutils literal"><span class="pre">nullable&lt;T&gt;</span></tt> as in</p>
with <tt class="docutils literal">nullable&lt;T&gt;</tt> as in</p>
<pre class="literal-block">
boost::ptr_vector&lt; boost::nullable&lt;animal&gt; &gt; vec;
vec.push_back( 0 ); // ok
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id4" id="all-default-iterators-apply-an-extra-layer-of-indirection" name="all-default-iterators-apply-an-extra-layer-of-indirection">All default iterators apply an extra layer of indirection</a></h1>
<p>This is done to
make the containers easier and safer to use. It promotes a kind of
pointer-less programming and the user of a class needs not worry about
pointers except when allocating them (see <a class="reference" href="examples.html">Example 2</a>). Iterators that
provide access to the naked pointers are also provided since they might be
useful in rare cases. For example, whenever <tt class="docutils literal"><span class="pre">begin()</span></tt> returns an iterator,
<tt class="docutils literal"><span class="pre">ptr_begin()</span></tt> will return an iterator that allows one to iterate over the
<div class="section" id="all-default-iterators-apply-an-extra-layer-of-indirection">
<h1><a class="toc-backref" href="#id4">All default iterators apply an extra layer of indirection</a></h1>
<p>This is done to
make the containers easier and safer to use. It promotes a kind of
pointer-less programming and the user of a class needs not worry about
pointers except when allocating them (see <a class="reference external" href="examples.html">Example 2</a>). Iterators that
provide access to the naked pointers are also provided since they might be
useful in rare cases. For example, whenever <tt class="docutils literal">begin()</tt> returns an iterator,
<tt class="docutils literal">ptr_begin()</tt> will return an iterator that allows one to iterate over the
stored pointers.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id5" id="all-comparison-operations-are-done-on-the-pointed-to-objects-and-not-at-the-pointer-level" name="all-comparison-operations-are-done-on-the-pointed-to-objects-and-not-at-the-pointer-level">All comparison operations are done on the pointed to objects and not at the pointer level</a></h1>
<p>For example, in <tt class="docutils literal"><span class="pre">ptr_set&lt;T&gt;</span></tt> the ordering is by default done by
<tt class="docutils literal"><span class="pre">boost::ptr_less&lt;T&gt;</span></tt> which compares the indirected pointers.
Similarly, <tt class="docutils literal"><span class="pre">operator==()</span></tt> for <tt class="docutils literal"><span class="pre">container&lt;Foo&gt;</span></tt> compares all objects
with <tt class="docutils literal"><span class="pre">operator==(const</span> <span class="pre">Foo&amp;,</span> <span class="pre">const</span> <span class="pre">Foo&amp;)</span></tt>.</p>
<div class="section" id="all-comparison-operations-are-done-on-the-pointed-to-objects-and-not-at-the-pointer-level">
<h1><a class="toc-backref" href="#id5">All comparison operations are done on the pointed to objects and not at the pointer level</a></h1>
<p>For example, in <tt class="docutils literal">ptr_set&lt;T&gt;</tt> the ordering is by default done by
<tt class="docutils literal"><span class="pre">boost::ptr_less&lt;T&gt;</span></tt> which compares the indirected pointers.
Similarly, <tt class="docutils literal"><span class="pre">operator==()</span></tt> for <tt class="docutils literal">container&lt;Foo&gt;</tt> compares all objects
with <tt class="docutils literal"><span class="pre">operator==(const</span> Foo&amp;, const Foo&amp;)</tt>.</p>
</div>
<div class="section">
<h1><a id="stored-elements-are-required-to-be-cloneable-for-a-subset-of-the-operations" name="stored-elements-are-required-to-be-cloneable-for-a-subset-of-the-operations">Stored elements are required to be <a class="reference" href="reference.html#the-Cloneable-concept">Cloneable</a> for a subset of the operations</a></h1>
<p>This is because most polymorphic objects cannot be copied directly, but
they can often be so by a use of a member function (see <a class="reference" href="examples.html">Example 4</a>). Often
it does not even make sense to clone an object in which case a large
<div class="section" id="stored-elements-are-required-to-be-cloneable-for-a-subset-of-the-operations">
<h1>Stored elements are required to be <a class="reference external" href="reference.html#the-Cloneable-concept">Cloneable</a> for a subset of the operations</h1>
<p>This is because most polymorphic objects cannot be copied directly, but
they can often be so by a use of a member function (see <a class="reference external" href="examples.html">Example 4</a>). Often
it does not even make sense to clone an object in which case a large
subset of the operations are still workable.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id7" id="whenever-objects-are-inserted-into-a-container-they-are-cloned-before-insertion" name="whenever-objects-are-inserted-into-a-container-they-are-cloned-before-insertion">Whenever objects are inserted into a container, they are cloned before insertion</a></h1>
<div class="section" id="whenever-objects-are-inserted-into-a-container-they-are-cloned-before-insertion">
<h1><a class="toc-backref" href="#id7">Whenever objects are inserted into a container, they are cloned before insertion</a></h1>
<p>This is necessary because all pointer containers take ownerships of stored objects
(see <a class="reference" href="examples.html">Example 5</a>).</p>
(see <a class="reference external" href="examples.html">Example 5</a>).</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id8" id="whenever-pointers-are-inserted-into-a-container-ownership-is-transferred-to-the-container" name="whenever-pointers-are-inserted-into-a-container-ownership-is-transferred-to-the-container">Whenever pointers are inserted into a container, ownership is transferred to the container</a></h1>
<p>All containers take ownership of the stored pointers and therefore a
container needs to have its own copies (see <a class="reference" href="examples.html">Example 5</a>).</p>
<div class="section" id="whenever-pointers-are-inserted-into-a-container-ownership-is-transferred-to-the-container">
<h1><a class="toc-backref" href="#id8">Whenever pointers are inserted into a container, ownership is transferred to the container</a></h1>
<p>All containers take ownership of the stored pointers and therefore a
container needs to have its own copies (see <a class="reference external" href="examples.html">Example 5</a>).</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id9" id="ownership-can-be-transferred-from-a-container-on-a-per-pointer-basis" name="ownership-can-be-transferred-from-a-container-on-a-per-pointer-basis">Ownership can be transferred from a container on a per pointer basis</a></h1>
<p>This can of course also be convenient. Whenever it happens, an
<tt class="docutils literal"><span class="pre">SmartContainer::auto_type</span></tt> object is used to provide an exception-safe transfer
(see <a class="reference" href="examples.html">Example 6</a>).</p>
<div class="section" id="ownership-can-be-transferred-from-a-container-on-a-per-pointer-basis">
<h1><a class="toc-backref" href="#id9">Ownership can be transferred from a container on a per pointer basis</a></h1>
<p>This can of course also be convenient. Whenever it happens, an
<tt class="docutils literal"><span class="pre">SmartContainer::auto_type</span></tt> object is used to provide an exception-safe transfer
(see <a class="reference external" href="examples.html">Example 6</a>).</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id10" id="ownership-can-be-transferred-from-a-container-to-another-container-on-a-per-iterator-range-basis" name="ownership-can-be-transferred-from-a-container-to-another-container-on-a-per-iterator-range-basis">Ownership can be transferred from a container to another container on a per iterator range basis</a></h1>
<p>This makes it possible to exchange data safely between different pointer
containers without cloning the objects again (see <a class="reference" href="examples.html">Example 7</a>).</p>
<div class="section" id="ownership-can-be-transferred-from-a-container-to-another-container-on-a-per-iterator-range-basis">
<h1><a class="toc-backref" href="#id10">Ownership can be transferred from a container to another container on a per iterator range basis</a></h1>
<p>This makes it possible to exchange data safely between different pointer
containers without cloning the objects again (see <a class="reference external" href="examples.html">Example 7</a>).</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id11" id="a-container-can-be-cheaply-returned-from-functions-either-by-making-a-clone-or-by-giving-up-ownership-of-the-container" name="a-container-can-be-cheaply-returned-from-functions-either-by-making-a-clone-or-by-giving-up-ownership-of-the-container">A container can be cheaply returned from functions either by making a clone or by giving up ownership of the container</a></h1>
<p>Two special member functions, <tt class="docutils literal"><span class="pre">clone()</span></tt> and <tt class="docutils literal"><span class="pre">release()</span></tt>, both return an
<tt class="docutils literal"><span class="pre">auto_ptr&lt;SmartContainer&gt;</span></tt> which can be assigned to another pointer container. This
effectively reduces the cost of returning a container to one
heap-allocation plus a call to <tt class="docutils literal"><span class="pre">swap()</span></tt> (see <a class="reference" href="examples.html">Example 3</a>).</p>
<div class="section" id="a-container-can-be-cheaply-returned-from-functions-either-by-making-a-clone-or-by-giving-up-ownership-of-the-container">
<h1><a class="toc-backref" href="#id11">A container can be cheaply returned from functions either by making a clone or by giving up ownership of the container</a></h1>
<p>Two special member functions, <tt class="docutils literal">clone()</tt> and <tt class="docutils literal">release()</tt>, both return a
<tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;SmartContainer&gt;</span></tt> which can be assigned to another pointer container. This
effectively reduces the cost of returning a container to one
heap-allocation plus a call to <tt class="docutils literal">swap()</tt> (see <a class="reference external" href="examples.html">Example 3</a>).</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id12" id="iterators-are-invalidated-as-in-the-corresponding-standard-container" name="iterators-are-invalidated-as-in-the-corresponding-standard-container">Iterators are invalidated as in the corresponding standard container</a></h1>
<div class="section" id="iterators-are-invalidated-as-in-the-corresponding-standard-container">
<h1><a class="toc-backref" href="#id12">Iterators are invalidated as in the corresponding standard container</a></h1>
<p>Because the containers in this library wrap standard containers, the
rules for invalidation of iterators are the same as the rules
of the corresponding standard container.</p>
@@ -387,14 +461,14 @@ element and elements following it; all elements before the inserted/deleted
element remain valid.</p>
<hr><p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<hr><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -88,8 +88,8 @@ containers without cloning the objects again (see `Example 7 <examples.html>`_).
A container can be cheaply returned from functions either by making a clone or by giving up ownership of the container
----------------------------------------------------------------------------------------------------------------------
Two special member functions, ``clone()`` and ``release()``, both return an
``auto_ptr<SmartContainer>`` which can be assigned to another pointer container. This
Two special member functions, ``clone()`` and ``release()``, both return a
``compatible-smart-ptr<SmartContainer>`` which can be assigned to another pointer container. This
effectively reduces the cost of returning a container to one
heap-allocation plus a call to ``swap()`` (see `Example 3 <examples.html>`_).

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -290,34 +363,35 @@ ul.auto-toc {
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<h2 class="subtitle" id="examples">Examples</h2>
<p>Some examples are given here and in the accompanying test files:</p>
<div class="contents local topic">
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference" href="#null-pointers-cannot-be-stored-in-the-containers" id="id2" name="id2">1. Null pointers cannot be stored in the containers</a></li>
<li><a class="reference" href="#iterators-and-other-operations-return-indirected-values" id="id3" name="id3">2. Iterators and other operations return indirected values</a></li>
<li><a class="reference" href="#copy-semantics-of-pointer-containers" id="id4" name="id4">3. Copy-semantics of pointer containers</a></li>
<li><a class="reference" href="#making-a-non-copyable-type-cloneable" id="id5" name="id5">4. Making a non-copyable type Cloneable</a></li>
<li><a class="reference" href="#objects-are-cloned-before-insertion-inserted-pointers-are-owned-by-the-container" id="id6" name="id6">5. Objects are cloned before insertion, inserted pointers are owned by the container</a></li>
<li><a class="reference" href="#transferring-ownership-of-a-single-element" id="id7" name="id7">6. Transferring ownership of a single element</a></li>
<li><a class="reference" href="#transferring-ownership-of-pointers-between-different-pointer-containers" id="id8" name="id8">7. Transferring ownership of pointers between different pointer containers</a></li>
<li><a class="reference" href="#selected-test-files" id="id9" name="id9">8. Selected test files</a></li>
<li><a class="reference" href="#a-large-example" id="id10" name="id10">9. A large example</a></li>
<li><a class="reference internal" href="#null-pointers-cannot-be-stored-in-the-containers" id="id2">1. Null pointers cannot be stored in the containers</a></li>
<li><a class="reference internal" href="#iterators-and-other-operations-return-indirected-values" id="id3">2. Iterators and other operations return indirected values</a></li>
<li><a class="reference internal" href="#copy-semantics-of-pointer-containers" id="id4">3. Copy-semantics of pointer containers</a></li>
<li><a class="reference internal" href="#making-a-non-copyable-type-cloneable" id="id5">4. Making a non-copyable type Cloneable</a></li>
<li><a class="reference internal" href="#objects-are-cloned-before-insertion-inserted-pointers-are-owned-by-the-container" id="id6">5. Objects are cloned before insertion, inserted pointers are owned by the container</a></li>
<li><a class="reference internal" href="#transferring-ownership-of-a-single-element" id="id7">6. Transferring ownership of a single element</a></li>
<li><a class="reference internal" href="#transferring-ownership-of-pointers-between-different-pointer-containers" id="id8">7. Transferring ownership of pointers between different pointer containers</a></li>
<li><a class="reference internal" href="#selected-test-files" id="id9">8. Selected test files</a></li>
<li><a class="reference internal" href="#a-large-example" id="id10">9. A large example</a></li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id2" id="null-pointers-cannot-be-stored-in-the-containers" name="null-pointers-cannot-be-stored-in-the-containers"><span id="example-1"></span>1. Null pointers cannot be stored in the containers</a></h1>
<div class="section" id="null-pointers-cannot-be-stored-in-the-containers">
<span id="example-1"></span><h1><a class="toc-backref" href="#id2">1. Null pointers cannot be stored in the containers</a></h1>
<pre class="literal-block">
my_container.push_back( 0 ); // throws bad_ptr
my_container.push_back( 0 ); // throws bad_ptr
my_container.replace( an_iterator, 0 ); // throws bad_ptr
my_container.insert( an_iterator, 0 ); // throws bad_ptr
my_container.insert( an_iterator, 0 ); // throws bad_ptr
std::auto_ptr&lt;T&gt; p( 0 );
my_container.push_back( p ); // throws bad_ptr
my_container.push_back( p ); // throws bad_ptr
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id3" id="iterators-and-other-operations-return-indirected-values" name="iterators-and-other-operations-return-indirected-values"><span id="example-2"></span>2. Iterators and other operations return indirected values</a></h1>
<div class="section" id="iterators-and-other-operations-return-indirected-values">
<span id="example-2"></span><h1><a class="toc-backref" href="#id3">2. Iterators and other operations return indirected values</a></h1>
<pre class="literal-block">
ptr_vector&lt;X&gt; pvec;
ptr_vector&lt;X&gt; pvec;
std::vector&lt;X*&gt; vec;
*vec.begin() = new X; // fine, memory leak
*pvec.begin() = new X; // compile time error
@@ -327,53 +401,53 @@ pvec.begin()-&gt;foo(); // no indirection needed
pvec.front() = X(); // no indirection needed
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id4" id="copy-semantics-of-pointer-containers" name="copy-semantics-of-pointer-containers"><span id="example-3"></span>3. Copy-semantics of pointer containers</a></h1>
<div class="section" id="copy-semantics-of-pointer-containers">
<span id="example-3"></span><h1><a class="toc-backref" href="#id4">3. Copy-semantics of pointer containers</a></h1>
<pre class="literal-block">
ptr_vector&lt;T&gt; vec1;
ptr_vector&lt;T&gt; vec1;
...
ptr_vector&lt;T&gt; vec2( vec1.clone() ); // deep copy objects of 'vec1' and use them to construct 'vec2', could be very expensive
vec2 = vec1.release(); // give up ownership of pointers in 'vec1' and pass the ownership to 'vec2', rather cheap
vec2.release(); // give up ownership; the objects will be deallocated if not assigned to another container
vec1 = vec2; // deep copy objects of 'vec2' and assign them to 'vec1', could be very expensive
vec1 = vec2; // deep copy objects of 'vec2' and assign them to 'vec1', could be very expensive
ptr_vector&lt;T&gt; vec3( vec1 ); // deep copy objects of 'vec1', could be very expensive
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id5" id="making-a-non-copyable-type-cloneable" name="making-a-non-copyable-type-cloneable"><span id="example-4"></span>4. Making a non-copyable type Cloneable</a></h1>
<div class="section" id="making-a-non-copyable-type-cloneable">
<span id="example-4"></span><h1><a class="toc-backref" href="#id5">4. Making a non-copyable type Cloneable</a></h1>
<pre class="literal-block">
// a class that has no normal copy semantics
class X : boost::noncopyable { public: X* clone() const; ... };
// this will be found by the library by argument dependent lookup (ADL)
X* new_clone( const X&amp; x )
// this will be found by the library by argument dependent lookup (ADL)
X* new_clone( const X&amp; x )
{ return x.clone(); }
// we can now use the interface that requires cloneability
ptr_vector&lt;X&gt; vec1, vec2;
...
vec2 = vec1.clone(); // 'clone()' requires cloning &lt;g&gt;
vec2.insert( vec2.end(), vec1.begin(), vec1.end() ); // inserting always means inserting clones
vec2 = vec1.clone(); // 'clone()' requires cloning &lt;g&gt;
vec2.insert( vec2.end(), vec1.begin(), vec1.end() ); // inserting always means inserting clones
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id6" id="objects-are-cloned-before-insertion-inserted-pointers-are-owned-by-the-container" name="objects-are-cloned-before-insertion-inserted-pointers-are-owned-by-the-container"><span id="example-5"></span>5. Objects are cloned before insertion, inserted pointers are owned by the container</a></h1>
<div class="section" id="objects-are-cloned-before-insertion-inserted-pointers-are-owned-by-the-container">
<span id="example-5"></span><h1><a class="toc-backref" href="#id6">5. Objects are cloned before insertion, inserted pointers are owned by the container</a></h1>
<pre class="literal-block">
class X { ... }; // assume 'X' is Cloneable
X x; // and 'X' can be stack-allocated
ptr_list&lt;X&gt; list;
class X { ... }; // assume 'X' is Cloneable
X x; // and 'X' can be stack-allocated
ptr_list&lt;X&gt; list;
list.push_back( new_clone( x ) ); // insert a clone
list.push_back( new X ); // always give the pointer directly to the container to avoid leaks
list.push_back( &amp;x ); // don't do this!!!
list.push_back( &amp;x ); // don't do this!!!
std::auto_ptr&lt;X&gt; p( new X );
list.push_back( p ); // give up ownership
BOOST_ASSERT( p.get() == 0 );
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id7" id="transferring-ownership-of-a-single-element" name="transferring-ownership-of-a-single-element"><span id="example-6"></span>6. Transferring ownership of a single element</a></h1>
<div class="section" id="transferring-ownership-of-a-single-element">
<span id="example-6"></span><h1><a class="toc-backref" href="#id7">6. Transferring ownership of a single element</a></h1>
<pre class="literal-block">
ptr_deque&lt;T&gt; deq;
ptr_deque&lt;T&gt; deq;
typedef ptr_deque&lt;T&gt;::auto_type auto_type;
// ... fill the container somehow
@@ -381,51 +455,51 @@ typedef ptr_deque&lt;T&gt;::auto_type auto_type;
auto_type ptr = deq.pop_back(); // remove back element from container and give up ownership
auto_type ptr2 = deq.release( deq.begin() + 2 ); // use an iterator to determine the element to release
ptr = deq.pop_front(); // supported for 'ptr_list' and 'ptr_deque'
deq.push_back( ptr.release() ); // give ownership back to the container
</pre>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id8" id="transferring-ownership-of-pointers-between-different-pointer-containers" name="transferring-ownership-of-pointers-between-different-pointer-containers"><span id="example-7"></span>7. Transferring ownership of pointers between different pointer containers</a></h1>
<div class="section" id="transferring-ownership-of-pointers-between-different-pointer-containers">
<span id="example-7"></span><h1><a class="toc-backref" href="#id8">7. Transferring ownership of pointers between different pointer containers</a></h1>
<pre class="literal-block">
ptr_list&lt;X&gt; list; ptr_vector&lt;X&gt; vec;
...
//
// note: no cloning happens in these examples
// note: no cloning happens in these examples
//
list.transfer( list.begin(), vec.begin(), vec ); // make the first element of 'vec' the first element of 'list'
vec.transfer( vec.end(), list.begin(), list.end(), list ); // put all the lists element into the vector
vec.transfer( vec.end(), list.begin(), list.end(), list ); // put all the lists element into the vector
</pre>
<p>We can also transfer objects from <tt class="docutils literal"><span class="pre">ptr_container&lt;Derived&gt;</span></tt> to <tt class="docutils literal"><span class="pre">ptr_container&lt;Base&gt;</span></tt> without any problems.</p>
<p>We can also transfer objects from <tt class="docutils literal">ptr_container&lt;Derived&gt;</tt> to <tt class="docutils literal">ptr_container&lt;Base&gt;</tt> without any problems.</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id9" id="selected-test-files" name="selected-test-files"><span id="example-8"></span>8. Selected test files</a></h1>
<div class="section" id="selected-test-files">
<span id="example-8"></span><h1><a class="toc-backref" href="#id9">8. Selected test files</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2"><a class="reference" href="../test/incomplete_type_test.cpp">incomplete_type_test.cpp</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Shows how to implement the Composite pattern.</td>
<tr class="field"><th class="field-name" colspan="2"><a class="reference external" href="../test/incomplete_type_test.cpp">incomplete_type_test.cpp</a>:</th></tr>
<tr class="field"><td>&nbsp;</td><td class="field-body">Shows how to implement the Composite pattern.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2"><a class="reference" href="../test/simple_test.cpp">simple_test.cpp</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Shows how the usage of pointer container compares with a
<tr class="field"><th class="field-name" colspan="2"><a class="reference external" href="../test/simple_test.cpp">simple_test.cpp</a>:</th></tr>
<tr class="field"><td>&nbsp;</td><td class="field-body">Shows how the usage of pointer container compares with a
container of smart pointers</td>
</tr>
<tr class="field"><th class="field-name" colspan="2"><a class="reference" href="../test/view_example.cpp">view_example.cpp</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Shows how to use a pointer container as a view into other container</td>
<tr class="field"><th class="field-name" colspan="2"><a class="reference external" href="../test/view_example.cpp">view_example.cpp</a>:</th></tr>
<tr class="field"><td>&nbsp;</td><td class="field-body">Shows how to use a pointer container as a view into other container</td>
</tr>
<tr class="field"><th class="field-name"><a class="reference" href="../test/tree_test.cpp">tree_test.cpp</a>:</th><td class="field-body">Shows how to make a tree-structure</td>
<tr class="field"><th class="field-name"><a class="reference external" href="../test/tree_test.cpp">tree_test.cpp</a>:</th><td class="field-body">Shows how to make a tree-structure</td>
</tr>
<tr class="field"><th class="field-name"><a class="reference" href="../test/ptr_array.cpp">array_test.cpp</a>:</th><td class="field-body">Shows how to make an n-ary tree</td>
<tr class="field"><th class="field-name"><a class="reference external" href="../test/ptr_array.cpp">array_test.cpp</a>:</th><td class="field-body">Shows how to make an n-ary tree</td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id10" id="a-large-example" name="a-large-example">9. A large example</a></h1>
<div class="section" id="a-large-example">
<h1><a class="toc-backref" href="#id10">9. A large example</a></h1>
<p>This example shows many of the most common
features at work. The example provide lots of comments.
The source code can also be found <a class="reference" href="../test/tut1.cpp">here</a>.</p>
The source code can also be found <a class="reference external" href="../test/tut1.cpp">here</a>.</p>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
@@ -577,6 +651,12 @@ The source code can also be found <a class="reference" href="../test/tut1.cpp">h
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>ptr_deque</span><span class=special>&lt;</span><span class=identifier>animal</span><span class=special>&gt;</span> <span class=identifier>barn_type</span><span class=special>;</span>
<span class=identifier>barn_type</span> <span class=identifier>barn</span><span class=special>;</span>
<span class=comment>//
// A convenience typedef for the compiler-appropriate
// smart pointer used to manage barns
//</span>
<span class=keyword>typedef</span> <span class=identifier><a href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a></span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>raii_ptr</span><span class=special>;</span>
<span class=comment>//
// An error type
//</span>
@@ -679,8 +759,9 @@ The source code can also be found <a class="reference" href="../test/tut1.cpp">h
<span class=comment>//
// If things are bad, we might choose to sell all animals :-(
//</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>auto_ptr</span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>sell_farm</span><span class=special>()</span>
//</span>
<span class=identifier>raii_ptr</span> <span class=identifier>sell_farm</span><span class=special>()</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>barn</span><span class=special>.</span><span class=identifier>release</span><span class=special>();</span>
<span class=special>}</span>
@@ -690,7 +771,7 @@ The source code can also be found <a class="reference" href="../test/tut1.cpp">h
// else's farm :-)
//</span>
<span class=keyword>void</span> <span class=identifier>buy_farm</span><span class=special>(</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>auto_ptr</span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>other</span> <span class=special>)</span>
<span class=keyword>void</span> <span class=identifier>buy_farm</span><span class=special>(</span> <span class=identifier>raii_ptr</span> <span class=identifier>other</span> <span class=special>)</span>
<span class=special>{</span>
<span class=comment>//
// This line inserts all the animals from 'other'
@@ -794,7 +875,7 @@ The source code can also be found <a class="reference" href="../test/tut1.cpp">h
<!-- 10. Changing the Clone Allocator
++++++++++++++++++++++++++++++++
This example shows how we can change
This example shows how we can change
the Clone Allocator to use the pointer containers
as view into other containers:
@@ -802,14 +883,14 @@ as view into other containers:
:file: tut2.html -->
<hr><p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<hr><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,19 +362,20 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-array" name="class-ptr-array">Class <tt class="docutils literal"><span class="pre">ptr_array</span></tt></a></h1>
<p>A <tt class="docutils literal"><span class="pre">ptr_array&lt;T,size&gt;</span></tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">boost::array&lt;void*,size&gt;</span></tt>
<div class="section" id="class-ptr-array">
<h1>Class <tt class="docutils literal">ptr_array</tt></h1>
<p>A <tt class="docutils literal">ptr_array&lt;T,size&gt;</tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">boost::array&lt;void*,size&gt;</span></tt>
to store the pointers. The class is useful when there is no requirement
of dynamic expansion and when no overhead is tolerable.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_array</span></tt></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
<li><tt class="docutils literal">ptr_array</tt></li>
</ul>
</li>
</ul>
@@ -309,44 +383,44 @@ of dynamic expansion and when no overhead is tolerable.</p>
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
{
template
&lt;
class T,
size_t N,
&lt;
class T,
size_t N,
CloneAllocator = heap_clone_allocator
&gt;
class ptr_array : public <em>implementation-defined</em>
{
public: // <a class="reference" href="#construct-copy-destroy">construct/copy/destroy</a>
public: // <a class="reference internal" href="#construct-copy-destroy">construct/copy/destroy</a>
ptr_array();
explicit ptr_array( const ptr_array&amp; r );
template&lt; class U &gt;
explicit ptr_array( const ptr_array&lt;U,N&gt;&amp; r );
explicit ptr_array( std::auto_ptr&lt;ptr_array&gt;&amp; r );
explicit ptr_array( const ptr_array&lt;U,N&gt;&amp; r );
explicit ptr_array( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt;&amp; r );
ptr_array&amp; operator=( const ptr_array&amp; r );
template&lt; class U &gt;
ptr_array&amp; operator=( const ptr_array&lt;U,N&gt;&amp; r );
ptr_array&amp; operator=( std::auto_ptr&lt;this_type&gt; r );
ptr_array&amp; operator=( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;this_type&gt; r );
public: // <a class="reference" href="reversible_ptr_container.html#iterators">iterators</a>
public: // <a class="reference external" href="reversible_ptr_container.html#iterators">iterators</a>
public: // <a class="reference" href="reversible_ptr_container.html#capacity">capacity</a>
public: // <a class="reference external" href="reversible_ptr_container.html#capacity">capacity</a>
public: // <a class="reference" href="#element-access">element access</a>
public: // <a class="reference internal" href="#element-access">element access</a>
T&amp; front();
const T&amp; front() const;
T&amp; back();
const T&amp; back() const;
template&lt; size_t idx &gt;
T&amp; at();
template&lt; size_t idx &gt;
@@ -357,33 +431,33 @@ namespace boost
T&amp; operator[]( size_t );
const T&amp; operator[]( size_t ) const;
public: // <a class="reference" href="#modifiers">modifiers</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
void swap( ptr_array&amp; r );
template&lt; size_t idx &gt;
auto_type replace( T* r );
template&lt; size_t idx, class U &gt;
auto_type replace( std::auto_ptr&lt;U&gt; r );
auto_type replace( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; r );
auto_type replace( size_t idx, T* r );
template&lt; class U &gt;
auto_type replace( size_t idx, std::auto_ptr&lt;U&gt; r );
auto_type replace( size_t idx, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; r );
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
std::auto_ptr&lt;ptr_array&gt; clone() const;
std::auto_ptr&lt;ptr_array&gt; release();
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt; clone() const;
<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt; release();
template&lt; size_t idx &gt;
bool is_null() const;
bool is_null( size_t idx ) const;
}; // class 'ptr_sequence_adapter'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-construct-copy-destroy" name="semantics-construct-copy-destroy"><span id="construct-copy-destroy"></span>Semantics: construct/copy/destroy</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-construct-copy-destroy">
<span id="construct-copy-destroy"></span><h2>Semantics: construct/copy/destroy</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array();</span></tt></p>
<blockquote>
@@ -392,32 +466,32 @@ namespace boost
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">explicit</span> <span class="pre">ptr_array(</span> <span class="pre">const</span> <span class="pre">ptr_array&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">explicit ptr_array( const ptr_array&amp; r );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span>
<span class="pre">explicit</span> <span class="pre">ptr_array(</span> <span class="pre">const</span> <span class="pre">ptr_array&lt;U,N&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt;
explicit ptr_array( const ptr_array&lt;U,N&gt;&amp; r );</tt></p>
<ul class="simple">
<li>Effects: Constructs array by cloning <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Effects: Constructs array by cloning <tt class="docutils literal">r</tt></li>
</ul>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array(</span> <span class="pre">std::auto_ptr&lt;ptr_array&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">ptr_array( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt;&amp;</span> r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: take ownership of the supplied pointers</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array&amp;</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">ptr_array&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">ptr_array&amp; operator=( const ptr_array&amp; r );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">ptr_array&amp;</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">ptr_array&lt;U,N&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; ptr_array&amp; operator=( const ptr_array&lt;U,N&gt;&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Effects: Assigns a clone of <tt class="docutils literal">r</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array&amp;</span> <span class="pre">operator=(</span> <span class="pre">std::auto_ptr&lt;this_type&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">ptr_array&amp; operator=( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;this_type&gt;</span> r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: take ownership of the supplied pointers</li>
@@ -427,70 +501,70 @@ namespace boost
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-element-access" name="semantics-element-access"><span id="element-access"></span>Semantics: element access</a></h2>
<div class="section" id="semantics-element-access">
<span id="element-access"></span><h2>Semantics: element access</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">front();</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">front();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">front()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; front() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*begin();</span></tt></li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*begin();</span></tt></li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if <tt class="docutils literal">empty() == true</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">back();</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">back();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">back()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; back() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*--end();</span></tt></li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*--end();</span></tt></li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if <tt class="docutils literal">empty() == true</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">&gt;</span> <span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; size_t idx &gt; T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at( size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">&gt;</span> <span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; size_t idx &gt; const T&amp; at( size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt> (compile-time enforced)</li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Requirements: <tt class="docutils literal">idx &lt; size()</tt> (compile-time enforced)</li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at( size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; at( size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&gt;=size()</span></tt></li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">n &gt;=size()</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">operator[](</span> size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; <span class="pre">operator[](</span> size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">swap(</span> <span class="pre">ptr_array&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void swap( ptr_array&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: swaps the two arrays</li>
@@ -499,56 +573,56 @@ namespace boost
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">T*</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; size_t idx &gt; auto_type replace( T* r );</tt></p>
<blockquote>
<ul>
<li><p class="first">Requirements:</p>
<blockquote>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt> (compile-time enforced)</li>
<li><tt class="docutils literal"><span class="pre">r</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li><tt class="docutils literal">idx &lt; size()</tt> (compile-time enforced)</li>
<li><tt class="docutils literal">r != 0</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first">Effects: returns the object indexed by <tt class="docutils literal"><span class="pre">idx</span></tt> and replaces it with <tt class="docutils literal"><span class="pre">r</span></tt>.</p>
<li><p class="first">Effects: returns the object indexed by <tt class="docutils literal">idx</tt> and replaces it with <tt class="docutils literal">r</tt>.</p>
</li>
<li><p class="first">Throws: <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt>.</p>
<li><p class="first">Throws: <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt>.</p>
</li>
<li><p class="first">Exception safety: Strong guarantee</p>
</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">size_t</span> <span class="pre">idx,</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; size_t idx, class U &gt; auto_type replace( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace&lt;idx&gt;(</span> <span class="pre">r.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return replace&lt;idx&gt;( r.release() );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_t</span> <span class="pre">idx,</span> <span class="pre">T*</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type replace( size_t idx, T* r );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: `` x != 0 and idx &lt; size()``</li>
<li>Effects: returns the object indexed by <tt class="docutils literal"><span class="pre">idx</span></tt> and replaces it with <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&gt;=</span> <span class="pre">size()</span></tt> and <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt>.</li>
<li>Effects: returns the object indexed by <tt class="docutils literal">idx</tt> and replaces it with <tt class="docutils literal">x</tt>.</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">idx &gt;= size()</tt> and <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt>.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_t</span> <span class="pre">idx,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; auto_type replace( size_t idx, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace(</span> <span class="pre">idx,</span> <span class="pre">r.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return replace( idx, r.release() );</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr&lt;ptr_array&gt;</span>&nbsp; <span class="pre">clone()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt;</span>&nbsp; clone() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a deep copy of the container</li>
@@ -557,30 +631,30 @@ namespace boost
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr&lt;ptr_array&gt;</span>&nbsp; <span class="pre">release();</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;ptr_array&gt;</span>&nbsp; <span class="pre">release();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Releases ownership of the container. This is a useful way of returning a container from a function.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt> and all pointers are null</li>
<li>Postconditions: <tt class="docutils literal">empty() == true</tt> and all pointers are null</li>
<li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if the return value cannot be allocated</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">&gt;</span> <span class="pre">bool</span> <span class="pre">is_null()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; size_t idx &gt; bool is_null() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt> (compile-time enforced)</li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li>
<li>Requirements: <tt class="docutils literal">idx &lt; size()</tt> (compile-time enforced)</li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal">idx</tt> is null</li>
<li>Exception safety: Nothrow guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">is_null(</span> <span class="pre">size_type</span> <span class="pre">idx</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool is_null( size_type idx ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li>
<li>Requirements: <tt class="docutils literal">idx &lt; size()</tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal">idx</tt> is null</li>
<li>Exception safety: Nothrow guarantee</li>
</ul>
</blockquote>
@@ -590,7 +664,7 @@ namespace boost
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -49,12 +49,12 @@ of dynamic expansion and when no overhead is tolerable.
explicit ptr_array( const ptr_array& r );
template< class U >
explicit ptr_array( const ptr_array<U,N>& r );
explicit ptr_array( std::auto_ptr<ptr_array>& r );
explicit ptr_array( compatible-smart-ptr<ptr_array>& r );
ptr_array& operator=( const ptr_array& r );
template< class U >
ptr_array& operator=( const ptr_array<U,N>& r );
ptr_array& operator=( std::auto_ptr<this_type> r );
ptr_array& operator=( compatible-smart-ptr<this_type> r );
public: // `iterators`_
@@ -82,14 +82,14 @@ of dynamic expansion and when no overhead is tolerable.
template< size_t idx >
auto_type replace( T* r );
template< size_t idx, class U >
auto_type replace( std::auto_ptr<U> r );
auto_type replace( compatible-smart-ptr<U> r );
auto_type replace( size_t idx, T* r );
template< class U >
auto_type replace( size_t idx, std::auto_ptr<U> r );
auto_type replace( size_t idx, compatible-smart-ptr<U> r );
public: // `pointer container requirements`_
std::auto_ptr<ptr_array> clone() const;
std::auto_ptr<ptr_array> release();
compatible-smart-ptr<ptr_array> clone() const;
compatible-smart-ptr<ptr_array> release();
template< size_t idx >
bool is_null() const;
bool is_null( size_t idx ) const;
@@ -122,7 +122,7 @@ Semantics: construct/copy/destroy
- Effects: Constructs array by cloning ``r``
- ``ptr_array( std::auto_ptr<ptr_array>& r );``
- ``ptr_array( compatible-smart-ptr<ptr_array>& r );``
- Effects: take ownership of the supplied pointers
@@ -134,7 +134,7 @@ Semantics: construct/copy/destroy
- Exception safety: Strong guarantee
- ``ptr_array& operator=( std::auto_ptr<this_type> r );``
- ``ptr_array& operator=( compatible-smart-ptr<this_type> r );``
- Effects: take ownership of the supplied pointers
@@ -220,7 +220,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< size_t idx, class U > auto_type replace( std::auto_ptr<U> r );``
- ``template< size_t idx, class U > auto_type replace( compatible-smart-ptr<U> r );``
- Effects: ``return replace<idx>( r.release() );``
@@ -234,7 +234,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > auto_type replace( size_t idx, std::auto_ptr<U> r );``
- ``template< class U > auto_type replace( size_t idx, compatible-smart-ptr<U> r );``
- Effects: ``return replace( idx, r.release() );``
@@ -243,7 +243,7 @@ Semantics: modifiers
Semantics: pointer container requirements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ``std::auto_ptr<ptr_array> clone() const;``
- ``compatible-smart-ptr<ptr_array> clone() const;``
- Effects: Returns a deep copy of the container
@@ -252,7 +252,7 @@ Semantics: pointer container requirements
- Complexity: Linear
- ``std::auto_ptr<ptr_array> release();``
- ``compatible-smart-ptr<ptr_array> release();``
- Effects: Releases ownership of the container. This is a useful way of returning a container from a function.

View File

@@ -3,18 +3,16 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<meta name="author" content="Thorsten Ottosen" />
<meta name="authors" content="Thorsten Ottosen" />
<meta name="date" content="27th of October 2007" />
<meta name="copyright" content="Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt)." />
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -23,10 +21,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -35,6 +40,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -45,6 +58,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -71,7 +88,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -95,7 +112,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -112,7 +130,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -154,14 +172,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -216,17 +272,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -253,7 +312,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -263,7 +323,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -277,13 +338,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -296,39 +369,40 @@ ul.auto-toc {
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<tr><th class="docinfo-name">Authors:</th>
<td>Thorsten Ottosen</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first reference" href="mailto:nesotto&#64;cs.aau.dk">nesotto&#64;cs.aau.dk</a> or <a class="last reference" href="mailto:tottosen&#64;dezide.com">tottosen&#64;dezide.com</a></td></tr>
<tr class="field"><th class="docinfo-name">Organizations:</th><td class="field-body"><a class="reference" href="http://www.cs.aau.dk">Department of Computer Science</a>, Aalborg University, and <a class="reference" href="http://www.dezide.com">Dezide Aps</a></td>
<td><a class="first reference external" href="mailto:nesotto&#64;cs.aau.dk">nesotto&#64;cs.aau.dk</a> or <a class="last reference external" href="mailto:tottosen&#64;dezide.com">tottosen&#64;dezide.com</a></td></tr>
<tr class="organizations field"><th class="docinfo-name">Organizations:</th><td class="field-body"><a class="reference external" href="http://www.cs.aau.dk">Department of Computer Science</a>, Aalborg University, and <a class="reference external" href="http://www.dezide.com">Dezide Aps</a></td>
</tr>
<tr><th class="docinfo-name">Date:</th>
<td>27th of October 2007</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td></tr>
<td>Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td></tr>
</tbody>
</table>
<div class="section">
<h1><a id="overview" name="overview">Overview</a></h1>
<div class="section" id="overview">
<h1>Overview</h1>
<p>Boost.Pointer Container provides containers for holding heap-allocated
objects in an exception-safe manner and with minimal overhead.
The aim of the library is in particular to make OO programming
easier in C++ by establishing a standard set of classes, methods
and designs for dealing with OO specific problems</p>
<ul class="simple">
<li><a class="reference" href="#motivation">Motivation</a></li>
<li><a class="reference" href="tutorial.html">Tutorial</a></li>
<li><a class="reference" href="reference.html">Reference</a></li>
<li><a class="reference" href="guidelines.html">Usage guidelines</a></li>
<li><a class="reference" href="examples.html">Examples</a></li>
<li><a class="reference" href="headers.html">Library headers</a></li>
<li><a class="reference" href="faq.html">FAQ</a></li>
<li><a class="reference" href="#upgrading-from-boost-v-1-33">Upgrading from Boost v. 1.33.*</a></li>
<li><a class="reference" href="#upgrading-from-boost-v-1-34">Upgrading from Boost v. 1.34.*</a></li>
<li><a class="reference" href="#upgrading-from-boost-v-1-35">Upgrading from Boost v. 1.35.*</a></li>
<li><a class="reference" href="#future-developments">Future Developments</a></li>
<li><a class="reference" href="#acknowledgements">Acknowledgements</a></li>
<li><a class="reference" href="#references">References</a></li>
<li><a class="reference internal" href="#motivation">Motivation</a></li>
<li><a class="reference external" href="tutorial.html">Tutorial</a></li>
<li><a class="reference external" href="reference.html">Reference</a></li>
<li><a class="reference external" href="guidelines.html">Usage guidelines</a></li>
<li><a class="reference external" href="examples.html">Examples</a></li>
<li><a class="reference external" href="headers.html">Library headers</a></li>
<li><a class="reference external" href="faq.html">FAQ</a></li>
<li><a class="reference internal" href="#upgrading-from-boost-v-1-33">Upgrading from Boost v. 1.33.*</a></li>
<li><a class="reference internal" href="#upgrading-from-boost-v-1-34">Upgrading from Boost v. 1.34.*</a></li>
<li><a class="reference internal" href="#upgrading-from-boost-v-1-35">Upgrading from Boost v. 1.35.*</a></li>
<li><a class="reference internal" href="#upgrading-from-boost-v-1-66">Upgrading from Boost v. 1.66.*</a></li>
<li><a class="reference internal" href="#future-developments">Future Developments</a></li>
<li><a class="reference internal" href="#acknowledgements">Acknowledgements</a></li>
<li><a class="reference internal" href="#references">References</a></li>
</ul>
<!-- - `Conventions <conventions.html>`_
- `The Clonable Concept <reference.html#the-clonable-concept>`_
@@ -350,11 +424,11 @@ and designs for dealing with OO specific problems</p>
- `Class nullable <reference.html#class-nullable>`_
- `Exception classes <reference.html#exception-classes>`_ -->
</div>
<div class="section">
<h1><a id="motivation" name="motivation">Motivation</a></h1>
<div class="section" id="motivation">
<h1>Motivation</h1>
<p>Whenever a programmer wants to have a container of pointers to
heap-allocated objects, there is usually only one exception-safe way:
to make a container of smart pointers like <a class="reference" href="../../smart_ptr/shared_ptr.htm">boost::shared_ptr</a>
to make a container of smart pointers like <a class="reference external" href="../../smart_ptr/shared_ptr.htm">boost::shared_ptr</a>
This approach is suboptimal if</p>
<ol class="arabic simple">
<li>the stored objects are not shared, but owned exclusively, or</li>
@@ -364,12 +438,12 @@ This approach is suboptimal if</p>
<li>the overhead implied by smart pointers is inappropriate</li>
</ol>
<p>This library therefore provides standard-like containers that are for storing
heap-allocated or <a class="reference" href="reference.html#the-clonable-concept">cloned</a> objects (or in case of a map, the mapped object must be
heap-allocated or <a class="reference external" href="reference.html#the-clonable-concept">cloned</a> objects (or in case of a map, the mapped object must be
a heap-allocated or cloned object). For each of the standard
containers there is a pointer container equivalent that takes ownership of
the objects in an exception safe manner. In this respect the library is intended
to solve the so-called
<a class="reference" href="faq.html#what-is-the-polymorphic-class-problem">polymorphic class problem</a>.</p>
<a class="reference external" href="faq.html#what-is-the-polymorphic-class-problem">polymorphic class problem</a>.</p>
<p>The advantages of pointer containers are</p>
<ol class="arabic simple">
<li>Exception-safe pointer storage and manipulation.</li>
@@ -384,34 +458,34 @@ to solve the so-called
</ol>
<!-- -->
<ol class="arabic simple" start="4">
<li>No memory-overhead as containers of smart pointers can have (see <a class="footnote-reference" href="#id23" id="id2" name="id2">[11]</a> and <a class="footnote-reference" href="#id25" id="id3" name="id3">[12]</a>).</li>
<li>No memory-overhead as containers of smart pointers can have (see <a class="footnote-reference" href="#id23" id="id2">[11]</a> and <a class="footnote-reference" href="#id25" id="id3">[12]</a>).</li>
</ol>
<!-- -->
<ol class="arabic simple" start="5">
<li>Usually faster than using containers of smart pointers (see <a class="footnote-reference" href="#id23" id="id4" name="id4">[11]</a> and <a class="footnote-reference" href="#id25" id="id5" name="id5">[12]</a>).</li>
<li>Usually faster than using containers of smart pointers (see <a class="footnote-reference" href="#id23" id="id4">[11]</a> and <a class="footnote-reference" href="#id25" id="id5">[12]</a>).</li>
</ol>
<!-- -->
<ol class="arabic simple" start="6">
<li>The interface is slightly changed towards the domain of pointers
instead of relying on the normal value-based interface. For example,
now it is possible for <tt class="docutils literal"><span class="pre">pop_back()</span></tt> to return the removed element.</li>
now it is possible for <tt class="docutils literal">pop_back()</tt> to return the removed element.</li>
</ol>
<!-- -->
<ol class="arabic simple" start="7">
<li>Propagates constness such that one cannot modify the objects via a <tt class="docutils literal"><span class="pre">const_iterator</span></tt>.</li>
<li>Propagates constness such that one cannot modify the objects via a <tt class="docutils literal">const_iterator</tt>.</li>
</ol>
<!-- -->
<ol class="arabic simple" start="8">
<li>Built-in support for deep-copy semantics via the <a class="reference" href="reference.html#the-clonable-concept">the Clonable concept</a></li>
<li>Built-in support for deep-copy semantics via the <a class="reference external" href="reference.html#the-clonable-concept">the Clonable concept</a></li>
</ol>
<p>The disadvantages are</p>
<ol class="arabic simple">
<li>Less flexible than containers of smart pointers like <a class="reference" href="../../smart_ptr/shared_ptr.htm">boost::shared_ptr</a></li>
<li>Less flexible than containers of smart pointers like <a class="reference external" href="../../smart_ptr/shared_ptr.htm">boost::shared_ptr</a></li>
</ol>
<p>When you do need shared semantics, this library is not what you need.</p>
</div>
<div class="section">
<h1><a id="upgrading-from-boost-v-1-33" name="upgrading-from-boost-v-1-33">Upgrading from Boost v. <tt class="docutils literal"><span class="pre">1.33.*</span></tt></a></h1>
<div class="section" id="upgrading-from-boost-v-1-33">
<h1>Upgrading from Boost v. <tt class="docutils literal">1.33.*</tt></h1>
<p>If you upgrade from one of these versions of Boost, then there has been one
major interface change: map iterators now mimic iterators from <tt class="docutils literal"><span class="pre">std::map</span></tt>.
Previously you may have written</p>
@@ -442,7 +516,7 @@ std::auto_ptr&lt;T&gt; p( new T );
container.push_back( p );
</pre>
</li>
<li><p class="first">Derived-to-Base conversion in <tt class="docutils literal"><span class="pre">transfer()</span></tt>:</p>
<li><p class="first">Derived-to-Base conversion in <tt class="docutils literal">transfer()</tt>:</p>
<pre class="literal-block">
boost::ptr_vector&lt;Base&gt; vec;
boost::ptr_list&lt;Derived&gt; list;
@@ -451,13 +525,13 @@ vec.transfer( vec.begin(), list ); // now ok
</pre>
</li>
</ul>
<p>Also note that <a class="reference" href="../../assign/index.html">Boost.Assign</a> introduces better support
<p>Also note that <a class="reference external" href="../../assign/index.html">Boost.Assign</a> introduces better support
for pointer containers.</p>
</div>
<div class="section">
<h1><a id="upgrading-from-boost-v-1-34" name="upgrading-from-boost-v-1-34">Upgrading from Boost v. <tt class="docutils literal"><span class="pre">1.34.*</span></tt></a></h1>
<div class="section" id="upgrading-from-boost-v-1-34">
<h1>Upgrading from Boost v. <tt class="docutils literal">1.34.*</tt></h1>
<p>Serialization has now been made optional thanks to Sebastian Ramacher.
You simply include <tt class="docutils literal"><span class="pre">&lt;boost/ptr_container/serialize.hpp&gt;</span></tt> or perhaps
You simply include <tt class="docutils literal">&lt;boost/ptr_container/serialize.hpp&gt;</tt> or perhaps
just one of the more specialized headers.</p>
<p>All containers are now copy-constructible and assignable. So you can e.g. now
do:</p>
@@ -479,62 +553,94 @@ sometimes needed when you want to provide extra functionality.</p>
void resize( size_type size );
void resize( size_type size, T* to_clone );
</pre>
<p><tt class="docutils literal"><span class="pre">ptr_vector&lt;T&gt;</span></tt> has a few new helper functions to integrate better with C-arrays:</p>
<p><tt class="docutils literal">ptr_vector&lt;T&gt;</tt> has a few new helper functions to integrate better with C-arrays:</p>
<pre class="literal-block">
void transfer( iterator before, T** from, size_type size, bool delete_from = true );
T** c_array();
</pre>
<p>Finally, you can now also &quot;copy&quot; and &quot;assign&quot; an <tt class="docutils literal"><span class="pre">auto_type</span></tt> ptr by calling <tt class="docutils literal"><span class="pre">move()</span></tt>:</p>
<p>Finally, you can now also &quot;copy&quot; and &quot;assign&quot; an <tt class="docutils literal">auto_type</tt> ptr by calling <tt class="docutils literal">move()</tt>:</p>
<pre class="literal-block">
boost::ptr_vector&lt;T&gt;::auto_type move_ptr = ...;
return boost::ptr_container::move( move_ptr );
</pre>
</div>
<div class="section">
<h1><a id="upgrading-from-boost-v-1-35" name="upgrading-from-boost-v-1-35">Upgrading from Boost v. <tt class="docutils literal"><span class="pre">1.35.*</span></tt></a></h1>
<div class="section" id="upgrading-from-boost-v-1-35">
<h1>Upgrading from Boost v. <tt class="docutils literal">1.35.*</tt></h1>
<p>The library has been fairly stable, but a few new containers have been supported:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">boost::ptr_unordered_set&lt;T&gt;</span></tt> in <tt class="docutils literal"><span class="pre">&lt;boost/ptr_container/ptr_unordered_set.hpp&gt;</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost::ptr_unordered_map&lt;Key,T&gt;</span></tt> in <tt class="docutils literal"><span class="pre">&lt;boost/ptr_container/ptr_unordered_map.hpp&gt;</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost::ptr_circular_buffer&lt;T&gt;</span></tt> in <tt class="docutils literal"><span class="pre">&lt;boost/ptr_container/ptr_circular_buffer.hpp&gt;</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost::ptr_unordered_set&lt;T&gt;</span></tt> in <tt class="docutils literal">&lt;boost/ptr_container/ptr_unordered_set.hpp&gt;</tt></li>
<li><tt class="docutils literal"><span class="pre">boost::ptr_unordered_map&lt;Key,T&gt;</span></tt> in <tt class="docutils literal">&lt;boost/ptr_container/ptr_unordered_map.hpp&gt;</tt></li>
<li><tt class="docutils literal"><span class="pre">boost::ptr_circular_buffer&lt;T&gt;</span></tt> in <tt class="docutils literal">&lt;boost/ptr_container/ptr_circular_buffer.hpp&gt;</tt></li>
</ul>
<p>There are no docs for these classes yet, but they are almost identical to
<tt class="docutils literal"><span class="pre">boost::ptr_set&lt;T&gt;</span></tt>, <tt class="docutils literal"><span class="pre">boost::ptr_map&lt;Key,T&gt;</span></tt> and <tt class="docutils literal"><span class="pre">boost::ptr_array&lt;T,N&gt;</span></tt>, respectively.
The underlying containers stem from the two boost libraries</p>
<ul class="simple">
<li><a class="reference" href="../../unordered/index.html">Boost.Unordered</a></li>
<li><a class="reference" href="../../circular_buffer/index.html">Boost.Circular Buffer</a></li>
<li><a class="reference external" href="../../unordered/index.html">Boost.Unordered</a></li>
<li><a class="reference external" href="../../circular_buffer/index.html">Boost.Circular Buffer</a></li>
</ul>
<p>Furthermore, <a class="reference" href="ptr_inserter.html">insert iterators</a> have been added.</p>
<p>Furthermore, <a class="reference external" href="ptr_inserter.html">insert iterators</a> have been added.</p>
</div>
<div class="section">
<h1><a id="future-developments" name="future-developments">Future Developments</a></h1>
<p>There are indications that the <tt class="docutils literal"><span class="pre">void*</span></tt> implementation has a slight
performance overhead compared to a <tt class="docutils literal"><span class="pre">T*</span></tt> based implementation. Furthermore, a
<tt class="docutils literal"><span class="pre">T*</span></tt> based implementation is so much easier to use type-safely
with algorithms. Therefore I anticipate to move to a <tt class="docutils literal"><span class="pre">T*</span></tt> based implementation.</p>
<p>Furthermore, the clone allocator might be allowed to have state.
<div class="section" id="upgrading-from-boost-v-1-66">
<h1>Upgrading from Boost v. <tt class="docutils literal">1.66.*</tt></h1>
<p>Starting with Boost v. <tt class="docutils literal">1.67.0</tt>, Boost.Pointer Container will use
<a class="reference external" href="../../config/index.html">Boost.Config</a> to conditionally provide
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>-based interfaces in addition to, or instead of,
interfaces using <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>. Details
are on the <a class="reference external" href="compatible_smart_ptr.html">Compatible Smart Pointer</a>
page, which also explains the convention in this documentation of using</p>
<pre class="literal-block">
<em>compatible-smart-ptr</em>&lt;T&gt;
</pre>
<p>to indicate such conditional interfaces.</p>
<p>For C++98/03 users, this change has no observable effect.</p>
<p>For C++11/14 users, there is no effect on existing code that used
previous versions of Boost.Pointer Container, but now all function
overloads taking an <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> parameter are accompanied by an
overload taking <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>. In the case of return types,
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> is still always used. Note however that until C++17,
it is possible to construct <tt class="docutils literal"><span class="pre">std::unique_ptr&lt;T&gt;</span></tt> implicitly from
<tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt>. Thus, users are free to modernize their code by
replacing any explicit mention of <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> with
<tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>. This change falls just short of a
search-and-replace conversion, as it is possible that some code may
have relied on <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> being copyable. But such situations
will result in compile-time errors which should be easy to fix.</p>
<p>Although <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> is formally removed as of ISO C++17,
certain compiler or standard library vendors have chosen to leave it
in for backwards compatibility. For compilers and standard libraries
where this is <em>not</em> the case, C++17 compilation of code using
Boost.Pointer Container is not possible with Boost v. <tt class="docutils literal">1.66.*</tt> or
earlier. This situation is fixed as of Boost v. <tt class="docutils literal">1.67.0</tt>.</p>
</div>
<div class="section" id="future-developments">
<h1>Future Developments</h1>
<p>There are indications that the <tt class="docutils literal">void*</tt> implementation has a slight
performance overhead compared to a <tt class="docutils literal">T*</tt> based implementation. Furthermore, a
<tt class="docutils literal">T*</tt> based implementation is so much easier to use type-safely
with algorithms. Therefore I anticipate to move to a <tt class="docutils literal">T*</tt> based implementation.</p>
<p>Furthermore, the clone allocator might be allowed to have state.
This design requires some thought, so if you have good ideas and use-cases'
for this, please don't hesitate to contact me.</p>
<p>Also, support for Boost.Interprocess is on the todo list.</p>
<p>There has been a few request for <tt class="docutils literal"><span class="pre">boost::ptr_multi_index_container&lt;T,...&gt;</span></tt>.
<p>There has been a few request for <tt class="docutils literal"><span class="pre">boost::ptr_multi_index_container&lt;T,...&gt;</span></tt>.
I investigated how difficult it would be, and it did turn out to be difficult, albeit
not impossible. But I don't have the resources to implement this beast
not impossible. But I don't have the resources to implement this beast
for years to come, so if someone really needs this container, I suggest that they
talk with me in private about how it can be done.</p>
</div>
<div class="section">
<h1><a id="acknowledgements" name="acknowledgements">Acknowledgements</a></h1>
<div class="section" id="acknowledgements">
<h1>Acknowledgements</h1>
<p>The following people have been very helpful:</p>
<ul class="simple">
<li>Bjørn D. Rasmussen for unintentionally motivating me to start this library</li>
<li>Pavel Vozenilek for asking me to make the adapters</li>
<li>David Abrahams for the <tt class="docutils literal"><span class="pre">indirect_fun</span></tt> design</li>
<li>David Abrahams for the <tt class="docutils literal">indirect_fun</tt> design</li>
<li>Pavol Droba for being review manager</li>
<li>Ross Boylan for trying out a prototype for real</li>
<li>Felipe Magno de Almeida for giving fedback based on using the
library in production code even before the library was part of boost</li>
<li>Jonathan Turkanis for supplying his <tt class="docutils literal"><span class="pre">move_ptr</span></tt> framework
<li>Jonathan Turkanis for supplying his <tt class="docutils literal">move_ptr</tt> framework
which is used internally</li>
<li>Stefan Slapeta and Howard Hinnant for Metrowerks support</li>
<li>Russell Hind for help with Borland compatibility</li>
@@ -545,88 +651,88 @@ which is used internally</li>
<li>Sebastian Ramacher for implementing the optional serialization support</li>
</ul>
</div>
<div class="section">
<h1><a id="references" name="references">References</a></h1>
<div class="section" id="references">
<h1>References</h1>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id8">[1]</a></td><td>Matt Austern: <a class="reference" href="http://www.cuj.com/documents/s=7990/cujcexp1910austern/">&quot;The Standard Librarian: Containers of Pointers&quot;</a> , C/C++ Users Journal Experts Forum.</td></tr>
<tr><td class="label">[1]</td><td>Matt Austern: <a class="reference external" href="http://www.cuj.com/documents/s=7990/cujcexp1910austern/">&quot;The Standard Librarian: Containers of Pointers&quot;</a> , C/C++ Users Journal Experts Forum.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id10" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id10">[2]</a></td><td>Bjarne Stroustrup, &quot;The C++ Programming Language&quot;, <a class="reference" href="http://www.research.att.com/~bs/3rd_safe.pdf">Appendix E: &quot;Standard-Library Exception Safety&quot;</a></td></tr>
<tr><td class="label">[2]</td><td>Bjarne Stroustrup, &quot;The C++ Programming Language&quot;, <a class="reference external" href="http://www.research.att.com/~bs/3rd_safe.pdf">Appendix E: &quot;Standard-Library Exception Safety&quot;</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id12" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id12">[3]</a></td><td>Herb Sutter, &quot;Exceptional C++&quot;.</td></tr>
<tr><td class="label">[3]</td><td>Herb Sutter, &quot;Exceptional C++&quot;.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id13" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id13">[4]</a></td><td>Herb Sutter, &quot;More Exceptional C++&quot;.</td></tr>
<tr><td class="label">[4]</td><td>Herb Sutter, &quot;More Exceptional C++&quot;.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id14" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id14">[5]</a></td><td>Kevlin Henney: <a class="reference" href="http://www.cuj.com/documents/s=7986/cujcexp2002henney/henney.htm">&quot;From Mechanism to Method: The Safe Stacking of Cats&quot;</a> , C++ Experts Forum, February 2002.</td></tr>
<tr><td class="label">[5]</td><td>Kevlin Henney: <a class="reference external" href="http://www.cuj.com/documents/s=7986/cujcexp2002henney/henney.htm">&quot;From Mechanism to Method: The Safe Stacking of Cats&quot;</a> , C++ Experts Forum, February 2002.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id16" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id16">[6]</a></td><td>Some of the few earlier attempts of pointer containers I have seen are the rather interesting <a class="reference" href="http://www.ntllib.org/asp.html">NTL</a> and the
<a class="reference" href="http://ootips.org/yonat/4dev/pointainer.h">pointainer</a>.
<tr><td class="label">[6]</td><td>Some of the few earlier attempts of pointer containers I have seen are the rather interesting <a class="reference external" href="http://www.ntllib.org/asp.html">NTL</a> and the
<a class="reference external" href="http://ootips.org/yonat/4dev/pointainer.h">pointainer</a>.
As of this writing both libraries are not exceptions-safe and can leak.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id17" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id17">[7]</a></td><td>INTERNATIONAL STANDARD, Programming languages --- C++, ISO/IEC 14882, 1998. See section 23 in particular.</td></tr>
<tr><td class="label">[7]</td><td>INTERNATIONAL STANDARD, Programming languages --- C++, ISO/IEC 14882, 1998. See section 23 in particular.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id18" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id18">[8]</a></td><td>C++ Standard Library Closed Issues List (Revision 27),
Item 218, <a class="reference" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#218">Algorithms do not use binary predicate objects for default comparisons</a>.</td></tr>
<tr><td class="label">[8]</td><td>C++ Standard Library Closed Issues List (Revision 27),
Item 218, <a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#218">Algorithms do not use binary predicate objects for default comparisons</a>.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id20" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id20">[9]</a></td><td>C++ Standard Library Active Issues List (Revision 27),
Item 226, <a class="reference" href="http://gcc.gnu.org/onlinedocs/libstdc++/ext/lwg-active.html#226">User supplied specializations or overloads of namespace std function templates</a>.</td></tr>
<tr><td class="label">[9]</td><td>C++ Standard Library Active Issues List (Revision 27),
Item 226, <a class="reference external" href="http://gcc.gnu.org/onlinedocs/libstdc++/ext/lwg-active.html#226">User supplied specializations or overloads of namespace std function templates</a>.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id22" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id22">[10]</a></td><td>Harald Nowak, &quot;A remove_if for vector&quot;, C/C++ Users Journal, July 2001.</td></tr>
<tr><td class="label">[10]</td><td>Harald Nowak, &quot;A remove_if for vector&quot;, C/C++ Users Journal, July 2001.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id23" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id23">[11]</a></td><td><em>(<a class="fn-backref" href="#id2">1</a>, <a class="fn-backref" href="#id4">2</a>)</em> Boost smart pointer <a class="reference" href="http://www.boost.org/libs/smart_ptr/smarttests.htm">timings</a></td></tr>
<tr><td class="label">[11]</td><td><em>(<a class="fn-backref" href="#id2">1</a>, <a class="fn-backref" href="#id4">2</a>)</em> Boost smart pointer <a class="reference external" href="http://www.boost.org/libs/smart_ptr/smarttests.htm">timings</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id25" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id25">[12]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id5">2</a>)</em> <a class="reference" href="http://www.ntllib.org/asp.html">NTL</a>: Array vs std::vector and boost::shared_ptr</td></tr>
<tr><td class="label">[12]</td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id5">2</a>)</em> <a class="reference external" href="http://www.ntllib.org/asp.html">NTL</a>: Array vs std::vector and boost::shared_ptr</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id26" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id26">[13]</a></td><td>Kevlin Henney, <a class="reference" href="http://www.two-sdg.demon.co.uk/curbralan/papers/europlop/NullObject.pdf">Null Object</a>, 2002.</td></tr>
<tr><td class="label">[13]</td><td>Kevlin Henney, <a class="reference external" href="http://www.two-sdg.demon.co.uk/curbralan/papers/europlop/NullObject.pdf">Null Object</a>, 2002.</td></tr>
</tbody>
</table>
<hr><table class="docutils field-list" frame="void" rules="none">

View File

@@ -38,6 +38,7 @@ and designs for dealing with OO specific problems
* `Upgrading from Boost v. 1.33.*`_
* `Upgrading from Boost v. 1.34.*`_
* `Upgrading from Boost v. 1.35.*`_
* `Upgrading from Boost v. 1.66.*`_
* `Future Developments`_
* Acknowledgements_
* References_
@@ -248,7 +249,47 @@ The underlying containers stem from the two boost libraries
- `Boost.Circular Buffer <../../circular_buffer/index.html>`_
Furthermore, `insert iterators <ptr_inserter.html>`_ have been added.
Furthermore, `insert iterators <ptr_inserter.html>`_ have been added.
===================================
Upgrading from Boost v. ``1.66.*``
===================================
Starting with Boost v. ``1.67.0``, Boost.Pointer Container will use
`Boost.Config <../../config/index.html>`_ to conditionally provide
``std::unique_ptr``-based interfaces in addition to, or instead of,
interfaces using ``std::auto_ptr``. Details
are on the `Compatible Smart Pointer <compatible_smart_ptr.html>`_
page, which also explains the convention in this documentation of using
.. parsed-literal::
*compatible-smart-ptr*\ <T>
to indicate such conditional interfaces.
For C++98/03 users, this change has no observable effect.
For C++11/14 users, there is no effect on existing code that used
previous versions of Boost.Pointer Container, but now all function
overloads taking an ``std::auto_ptr`` parameter are accompanied by an
overload taking ``std::unique_ptr``. In the case of return types,
``std::auto_ptr`` is still always used. Note however that until C++17,
it is possible to construct ``std::unique_ptr<T>`` implicitly from
``std::auto_ptr<T>``. Thus, users are free to modernize their code by
replacing any explicit mention of ``std::auto_ptr`` with
``std::unique_ptr``. This change falls just short of a
search-and-replace conversion, as it is possible that some code may
have relied on ``std::auto_ptr`` being copyable. But such situations
will result in compile-time errors which should be easy to fix.
Although ``std::auto_ptr`` is formally removed as of ISO C++17,
certain compiler or standard library vendors have chosen to leave it
in for backwards compatibility. For compilers and standard libraries
where this is *not* the case, C++17 compilation of code using
Boost.Pointer Container is not possible with Boost v. ``1.66.*`` or
earlier. This situation is fixed as of Boost v. ``1.67.0``.
=====================
Future Developments

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,18 +362,19 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-deque" name="class-ptr-deque">Class <tt class="docutils literal"><span class="pre">ptr_deque</span></tt></a></h1>
<p>A <tt class="docutils literal"><span class="pre">ptr_deque&lt;T&gt;</span></tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">std:deque&lt;void*&gt;</span></tt>
<div class="section" id="class-ptr-deque">
<h1>Class <tt class="docutils literal">ptr_deque</tt></h1>
<p>A <tt class="docutils literal">ptr_deque&lt;T&gt;</tt> is a pointer container that uses an underlying <tt class="docutils literal">std:deque&lt;void*&gt;</tt>
to store the pointers.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_deque</span></tt></li>
<li><a class="reference" href="ptr_array.html">ptr_array</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><tt class="docutils literal">ptr_deque</tt></li>
<li><a class="reference external" href="ptr_array.html">ptr_array</a></li>
</ul>
</li>
</ul>
@@ -308,17 +382,17 @@ to store the pointers.</p>
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
{
template
&lt;
class T,
&lt;
class T,
class CloneAllocator = heap_clone_allocator
class Allocator = std::allocator&lt;void*&gt;
&gt;
@@ -330,48 +404,48 @@ namespace boost
&gt;
{
public: // <a class="reference" href="#element-access">element access</a>
public: // <a class="reference internal" href="#element-access">element access</a>
T&amp; operator[]( size_type n );
const T&amp; operator[]( size_type n ) const;
T&amp; at( size_type n );
const T&amp; at( size_type n ) const;
public: // <a class="reference" href="#modifiers">modifiers</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
void push_front( T* x );
template&lt; class U &gt;
void push_front( std::auto_ptr&lt;U&gt; x );
void push_front( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
auto_type pop_front();
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
auto_type replace( size_type idx, T* x );
template&lt; class U &gt;
auto_type replace( size_type idx, std::auto_ptr&lt;U&gt; x );
bool is_null( size_type idx ) const;
auto_type replace( size_type idx, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
bool is_null( size_type idx ) const;
};
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">push_front(</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void push_front( T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Inserts the pointer into container and takes ownership of it</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Throws: <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">push_front(</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; void push_front( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">push_front(</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">push_front( x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -382,71 +456,71 @@ namespace boost
- Exception safety: Strong guarantee -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">pop_front():</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type <span class="pre">pop_front():</span></tt></p>
<blockquote>
<ul class="simple">
<li>Requirements:<tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty()</span></tt></li>
<li>Requirements:<tt class="docutils literal">not empty()</tt></li>
<li>Effects: Removes the first element in the container</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one less</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if <tt class="docutils literal">empty() == true</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-element-access" name="semantics-element-access"><span id="element-access"></span>Semantics: element access</a></h2>
<div class="section" id="semantics-element-access">
<span id="element-access"></span><h2>Semantics: element access</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; <span class="pre">operator[](</span> size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; <span class="pre">operator[](</span> size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; at( size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; at( size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&gt;=size()</span></tt></li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">n &gt;=size()</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_type</span> <span class="pre">idx,</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type replace( size_type idx, T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: `` x != 0 and idx &lt; size()``</li>
<li>Effects: returns the object indexed by <tt class="docutils literal"><span class="pre">idx</span></tt> and replaces it with <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&gt;=</span> <span class="pre">size()</span></tt> and <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt>.</li>
<li>Effects: returns the object indexed by <tt class="docutils literal">idx</tt> and replaces it with <tt class="docutils literal">x</tt>.</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">idx &gt;= size()</tt> and <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt>.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_type</span> <span class="pre">idx,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; auto_type replace( size_type idx, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace(</span> <span class="pre">idx,</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return replace( idx, x.release() );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">is_null(</span> <span class="pre">size_type</span> <span class="pre">idx</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool is_null( size_type idx ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li>
<li>Requirements: <tt class="docutils literal">idx &lt; size()</tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal">idx</tt> is null</li>
<li>Exception safety: Nothrow guarantee</li>
</ul>
</blockquote>
@@ -456,7 +530,7 @@ namespace boost
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -57,13 +57,13 @@ to store the pointers.
public: // modifiers_
void push_front( T* x );
template< class U >
void push_front( std::auto_ptr<U> x );
void push_front( compatible-smart-ptr<U> x );
auto_type pop_front();
public: // `pointer container requirements`_
auto_type replace( size_type idx, T* x );
template< class U >
auto_type replace( size_type idx, std::auto_ptr<U> x );
auto_type replace( size_type idx, compatible-smart-ptr<U> x );
bool is_null( size_type idx ) const;
};
@@ -93,7 +93,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > void push_front( std::auto_ptr<U> x );``
- ``template< class U > void push_front( compatible-smart-ptr<U> x );``
- Effects: ``push_front( x.release() );``
@@ -156,7 +156,7 @@ Semantics: pointer container requirements
- Exception safety: Strong guarantee
- ``template< class U > auto_type replace( size_type idx, std::auto_ptr<U> x );``
- ``template< class U > auto_type replace( size_type idx, compatible-smart-ptr<U> x );``
- Effects: ``return replace( idx, x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,18 +362,19 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-list" name="class-ptr-list">Class <tt class="docutils literal"><span class="pre">ptr_list</span></tt></a></h1>
<p>A <tt class="docutils literal"><span class="pre">ptr_list&lt;T&gt;</span></tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">std:list&lt;void*&gt;</span></tt>
<div class="section" id="class-ptr-list">
<h1>Class <tt class="docutils literal">ptr_list</tt></h1>
<p>A <tt class="docutils literal">ptr_list&lt;T&gt;</tt> is a pointer container that uses an underlying <tt class="docutils literal">std:list&lt;void*&gt;</tt>
to store the pointers.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_list</span></tt></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference" href="ptr_array.html">ptr_array</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><tt class="docutils literal">ptr_list</tt></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference external" href="ptr_array.html">ptr_array</a></li>
</ul>
</li>
</ul>
@@ -308,17 +382,17 @@ to store the pointers.</p>
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
{
template
&lt;
class T,
&lt;
class T,
class CloneAllocator = heap_clone_allocator,
class Allocator = std::allocator&lt;void*&gt;
&gt;
@@ -329,40 +403,40 @@ namespace boost
CloneAllocator
&gt;
{
public: // <a class="reference" href="#modifiers">modifiers</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
void push_front( T* x );
template&lt; class U &gt;
void push_front( std::auto_ptr&lt;U&gt; x );
void push_front( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
auto_type pop_front();
public: // <a class="reference" href="#list-operations">list operations</a>
public: // <a class="reference internal" href="#list-operations">list operations</a>
void reverse();
}; // class 'ptr_list'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">push_front(</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void push_front( T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Inserts the pointer into container and takes ownership of it</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Throws: <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">push_front(</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; void push_front( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">push_front(</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">push_front( x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -373,21 +447,21 @@ namespace boost
- Exception safety: Strong guarantee -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">pop_front():</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type <span class="pre">pop_front():</span></tt></p>
<blockquote>
<ul class="simple">
<li>Requirements:<tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty()</span></tt></li>
<li>Requirements:<tt class="docutils literal">not empty()</tt></li>
<li>Effects: Removes the first element in the container</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one less</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if <tt class="docutils literal">empty() == true</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-list-operations" name="semantics-list-operations"><span id="list-operations"></span>Semantics: list operations</a></h2>
<div class="section" id="semantics-list-operations">
<span id="list-operations"></span><h2>Semantics: list operations</h2>
<!-- - ``void splice( iterator before, ptr_list& x );``
- Requirements:``&x != this``
@@ -395,7 +469,7 @@ namespace boost
- Effects: inserts the all of ``x``'s elements before ``before``
- Postconditions: ``x.empty()``
- Throws: nothing
- Remark: prefer this to ``transfer( before, x );``
@@ -411,13 +485,13 @@ namespace boost
- ``void merge( ptr_list& x );``
- Not ready yet
- ``template< typename Compare >
- ``template< typename Compare >
void merge( ptr_list& x, Compare comp );``
- Not ready yet -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">reverse();</span></tt></p>
<li><p class="first"><tt class="docutils literal">void <span class="pre">reverse();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Effects: reverses the underlying sequence</li>
@@ -430,7 +504,7 @@ namespace boost
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -51,7 +51,7 @@ to store the pointers.
public: // modifiers_
void push_front( T* x );
template< class U >
void push_front( std::auto_ptr<U> x );
void push_front( compatible-smart-ptr<U> x );
auto_type pop_front();
public: // `list operations`_
@@ -80,7 +80,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > void push_front( std::auto_ptr<U> x );``
- ``template< class U > void push_front( compatible-smart-ptr<U> x );``
- Effects: ``push_front( x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,23 +362,24 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-map-adapter" name="class-ptr-map-adapter">Class <tt class="docutils literal"><span class="pre">ptr_map_adapter</span></tt></a></h1>
<div class="section" id="class-ptr-map-adapter">
<h1>Class <tt class="docutils literal">ptr_map_adapter</tt></h1>
<p>This class is used to build custom pointer containers with
an underlying map-like container. The interface of the class is an extension
of the interface from <tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt>.</p>
of the interface from <tt class="docutils literal">associative_ptr_container</tt>.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_map_adapter</span></tt></li>
<li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><tt class="docutils literal">ptr_map_adapter</tt></li>
<li><a class="reference external" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference external" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference external" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li>
</ul>
</li>
</ul>
@@ -315,22 +389,22 @@ of the interface from <tt class="docutils literal"><span class="pre">associative
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
template
&lt;
&lt;
class T,
class VoidPtrMap,
class CloneAllocator = heap_clone_allocator
class VoidPtrMap,
class CloneAllocator = heap_clone_allocator
&gt;
class ptr_map_adapter
class ptr_map_adapter
{
public: // <a class="reference" href="#typedefs">typedefs</a>
public: // <a class="reference internal" href="#typedefs">typedefs</a>
typedef VoidPtrMap::key_type key_type;
typedef T* mapped_type;
typedef T&amp; mapped_reference;
@@ -339,44 +413,44 @@ namespace boost
typedef ... reference;
typedef ... const_reference;
typedef ... pointer;
typedef ... const_pointer;
public: // <a class="reference" href="#modifiers">modifiers</a>
std::pair&lt;iterator,bool&gt; insert( key_type&amp; k, T* x );
template&lt; class U &gt;
std::pair&lt;iterator,bool&gt; insert( const key_type&amp; k, std::auto_ptr&lt;U&gt; x );
typedef ... const_pointer;
public; // <a class="reference" href="#lookup">lookup</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
std::pair&lt;iterator,bool&gt; insert( key_type&amp; k, T* x );
template&lt; class U &gt;
std::pair&lt;iterator,bool&gt; insert( const key_type&amp; k, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
public; // <a class="reference internal" href="#lookup">lookup</a>
T&amp; operator[]( const key_type&amp; key );
T&amp; at( const key_type&amp; key );
const T&amp; at( const key_type&amp; key ) const;
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
bool transfer( iterator object, ptr_map_adapter&amp; from );
size_type transfer( iterator first, iterator last, ptr_map_adapter&amp; from );
template&lt; class Range &gt;
size_type transfer( const Range&amp; r, ptr_map_adapter&amp; from );
size_type transfer( ptr_map_adapter&amp; from );
}; // class 'ptr_map_adapter'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-typedefs" name="semantics-typedefs"><span id="typedefs"></span>Semantics: typedefs</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-typedefs">
<span id="typedefs"></span><h2>Semantics: typedefs</h2>
<p>The following types are implementation defined:</p>
<pre class="literal-block">
typedef ... value_type;
typedef ... reference;
typedef ... const_reference;
typedef ... pointer;
typedef ... const_pointer;
typedef ... const_pointer;
</pre>
<p>However, the structure of the type mimics <tt class="docutils literal"><span class="pre">std::pair</span></tt> s.t. one
can use <tt class="docutils literal"><span class="pre">first</span></tt> and <tt class="docutils literal"><span class="pre">second</span></tt> members. The reference-types
can use <tt class="docutils literal">first</tt> and <tt class="docutils literal">second</tt> members. The reference-types
are not real references and the pointer-types are not real pointers.
However, one may still write</p>
<pre class="literal-block">
@@ -390,25 +464,25 @@ a_pointer-&gt;second-&gt;foo();
map_type::const_pointer a_cpointer = &amp;*const_begin(m);
</pre>
<p>The difference compared to <tt class="docutils literal"><span class="pre">std::map&lt;Key,T*&gt;</span></tt> is that constness
is propagated to the pointer (that is, to <tt class="docutils literal"><span class="pre">second</span></tt>) in <tt class="docutils literal"><span class="pre">const_itertor</span></tt>.</p>
is propagated to the pointer (that is, to <tt class="docutils literal">second</tt>) in <tt class="docutils literal">const_itertor</tt>.</p>
</div>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::pair&lt;iterator,bool&gt;</span> <span class="pre">insert(</span> <span class="pre">key_type&amp;</span> <span class="pre">k,</span> <span class="pre">value_type</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::pair&lt;iterator,bool&gt;</span> insert( key_type&amp; k, value_type x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal"><span class="pre">x</span></tt> and insert it iff there is no equivalent of it already. The bool part of the return value indicates insertion and the iterator points to the element with key <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal">x</tt> and insert it iff there is no equivalent of it already. The bool part of the return value indicates insertion and the iterator points to the element with key <tt class="docutils literal">x</tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">std::pair&lt;iterator,bool&gt;</span> <span class="pre">insert(</span> <span class="pre">const</span> <span class="pre">key_type&amp;</span> <span class="pre">k,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; <span class="pre">std::pair&lt;iterator,bool&gt;</span> insert( const key_type&amp; k, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Equivalent to (but without the <tt class="docutils literal"><span class="pre">const_cast</span></tt>): <tt class="docutils literal"><span class="pre">return</span> <span class="pre">insert(</span> <span class="pre">const_cast&lt;key_type&amp;&gt;(k),</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Equivalent to (but without the <tt class="docutils literal">const_cast</tt>): <tt class="docutils literal">return insert( <span class="pre">const_cast&lt;key_type&amp;&gt;(k),</span> x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -419,65 +493,65 @@ is propagated to the pointer (that is, to <tt class="docutils literal"><span cla
- Exception safety: Strong guarantee -->
</div>
<div class="section">
<h2><a id="semantics-lookup" name="semantics-lookup"><span id="lookup"></span>Semantics: lookup</a></h2>
<div class="section" id="semantics-lookup">
<span id="lookup"></span><h2>Semantics: lookup</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">const</span> <span class="pre">key_type&amp;</span> <span class="pre">key</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; <span class="pre">operator[](</span> const key_type&amp; key );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: returns the object with key <tt class="docutils literal"><span class="pre">key</span></tt> if it exists; otherwise a new object is allocated and inserted and its reference returned.</li>
<li>Effects: returns the object with key <tt class="docutils literal">key</tt> if it exists; otherwise a new object is allocated and inserted and its reference returned.</li>
<li>Exception-safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="pre">at(</span> <span class="pre">const</span> <span class="pre">key_type&amp;</span> <span class="pre">key</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at( const key_type&amp; key );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">const</span> <span class="pre">key_type&amp;</span> <span class="pre">jey</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; at( const key_type&amp; jey ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirement: the key exists</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if the key does not exist</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if the key does not exist</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">object,</span> <span class="pre">ptr_map_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool transfer( iterator object, ptr_map_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal"><span class="pre">object</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>
iff no equivalent object exists.</li>
<li>Returns: whether the object was transfered</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr__set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type transfer( iterator first, iterator last, ptr__set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal"><span class="pre">[first,last)</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.
An object is only transferred if no equivalent object exists.</li>
<li>Returns: the number of transfered objects</li>
<li>Exception safety: Basic guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r,</span> <span class="pre">ptr_map_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Range &gt; void transfer( const Range&amp; r, ptr_map_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">transfer(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> <span class="pre">from</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return transfer( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">transfer(</span> <span class="pre">ptr_set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type transfer( ptr_set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">transfer(</span> <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> <span class="pre">from</span> <span class="pre">);</span></tt>.</li>
<li>Effects: <tt class="docutils literal">return transfer( <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> from );</tt>.</li>
</ul>
</blockquote>
</li>
@@ -486,7 +560,7 @@ An object is only transferred if no equivalent object exists.</li>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -61,7 +61,7 @@ of the interface from ``associative_ptr_container``.
public: // `modifiers`_
std::pair<iterator,bool> insert( key_type& k, T* x );
template< class U >
std::pair<iterator,bool> insert( const key_type& k, std::auto_ptr<U> x );
std::pair<iterator,bool> insert( const key_type& k, compatible-smart-ptr<U> x );
public; // `lookup`_
T& operator[]( const key_type& key );
@@ -129,7 +129,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > std::pair<iterator,bool> insert( const key_type& k, std::auto_ptr<U> x );``
- ``template< class U > std::pair<iterator,bool> insert( const key_type& k, compatible-smart-ptr<U> x );``
- Equivalent to (but without the ``const_cast``): ``return insert( const_cast<key_type&>(k), x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,23 +362,24 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-multimap-adapter" name="class-ptr-multimap-adapter">Class <tt class="docutils literal"><span class="pre">ptr_multimap_adapter</span></tt></a></h1>
<div class="section" id="class-ptr-multimap-adapter">
<h1>Class <tt class="docutils literal">ptr_multimap_adapter</tt></h1>
<p>This class is used to build custom pointer containers with
an underlying multimap-like container. The interface of the class is an extension
of the interface from <tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt>.</p>
of the interface from <tt class="docutils literal">associative_ptr_container</tt>.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_multi_map_adapter</span></tt><ul>
<li><a class="reference" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><tt class="docutils literal">ptr_multi_map_adapter</tt><ul>
<li><a class="reference external" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference external" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li>
</ul>
</li>
</ul>
@@ -315,22 +389,22 @@ of the interface from <tt class="docutils literal"><span class="pre">associative
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
template
&lt;
&lt;
T,
class VoidPtrMultiMap,
class CloneAllocator = heap_clone_allocator
class CloneAllocator = heap_clone_allocator
&gt;
class ptr_multimap_adapter
class ptr_multimap_adapter
{
public: // <a class="reference" href="#typedefs">typedefs</a>
public: // <a class="reference internal" href="#typedefs">typedefs</a>
typedef VoidPtrMap::key_type key_type;
typedef T* mapped_type;
typedef T&amp; mapped_reference;
@@ -339,14 +413,14 @@ namespace boost
typedef ... reference;
typedef ... const_reference;
typedef ... pointer;
typedef ... const_pointer;
public: // <a class="reference" href="#modifiers">modifiers</a>
iterator insert( key_type&amp; k, T* x );
template&lt; class U &gt;
iterator insert( const key_type&amp;, std::auto_ptr&lt;U&gt; x );
typedef ... const_pointer;
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
iterator insert( key_type&amp; k, T* x );
template&lt; class U &gt;
iterator insert( const key_type&amp;, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
void transfer( iterator object, ptr_multimap_adapter&amp; from );
size_type transfer( iterator first, iterator last, ptr_multimap_adapter&amp; from );
template&lt; class Range &gt;
@@ -355,24 +429,24 @@ namespace boost
}; // class 'ptr_multimap_adapter'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section" id="semantics">
<h1>Semantics</h1>
<p>. <span class="target" id="typedefs">typedefs</span>:</p>
<div class="section">
<h2><a id="semantics-typedefs" name="semantics-typedefs">Semantics: typedefs</a></h2>
<div class="section" id="semantics-typedefs">
<h2>Semantics: typedefs</h2>
<p>The following types are implementation defined:</p>
<pre class="literal-block">
typedef ... value_type;
typedef ... reference;
typedef ... const_reference;
typedef ... pointer;
typedef ... const_pointer;
typedef ... const_pointer;
</pre>
<p>However, the structure of the type mimics <tt class="docutils literal"><span class="pre">std::pair</span></tt> s.t. one
can use <tt class="docutils literal"><span class="pre">first</span></tt> and <tt class="docutils literal"><span class="pre">second</span></tt> members. The reference-types
can use <tt class="docutils literal">first</tt> and <tt class="docutils literal">second</tt> members. The reference-types
are not real references and the pointer-types are not real pointers.
However, one may still write</p>
<pre class="literal-block">
@@ -386,25 +460,25 @@ a_pointer-&gt;second-&gt;foo();
map_type::const_pointer a_cpointer = &amp;*const_begin(m);
</pre>
<p>The difference compared to <tt class="docutils literal"><span class="pre">std::map&lt;Key,T*&gt;</span></tt> is that constness
is propagated to the pointer (that is, to <tt class="docutils literal"><span class="pre">second</span></tt>) in <tt class="docutils literal"><span class="pre">const_itertor</span></tt>.</p>
is propagated to the pointer (that is, to <tt class="docutils literal">second</tt>) in <tt class="docutils literal">const_itertor</tt>.</p>
</div>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">key_type&amp;</span> <span class="pre">k,</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator insert( key_type&amp; k, T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal"><span class="pre">x</span></tt> and returns an iterator pointing to it.</li>
<li>Throws: bad_pointer if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal">x</tt> and returns an iterator pointing to it.</li>
<li>Throws: bad_pointer if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">const</span> <span class="pre">key_type&amp;</span> <span class="pre">k,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; iterator insert( const key_type&amp; k, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Equivalent to (but without the <tt class="docutils literal"><span class="pre">const_cast</span></tt>): <tt class="docutils literal"><span class="pre">return</span> <span class="pre">insert(</span> <span class="pre">const_cast&lt;key_type&amp;&gt;(k),</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Equivalent to (but without the <tt class="docutils literal">const_cast</tt>): <tt class="docutils literal">return insert( <span class="pre">const_cast&lt;key_type&amp;&gt;(k),</span> x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -424,42 +498,42 @@ is propagated to the pointer (that is, to <tt class="docutils literal"><span cla
- Effects: returns the object with key ``key``
- Throws: ``bad_ptr_container_operation`` if the key does not exist -->
- Throws: ``bad_ptr_container_operation`` if the key does not exist -->
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">object,</span> <span class="pre">ptr_multimap_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator object, ptr_multimap_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal"><span class="pre">object</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is one less.</li>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one more, <tt class="docutils literal">from.size()</tt> is one less.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr_multimap_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator first, iterator last, ptr_multimap_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal"><span class="pre">[first,last)</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.</li>
<li>Postconditions: Let <tt class="docutils literal"><span class="pre">N</span> <span class="pre">==</span> <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal"><span class="pre">size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> less.</li>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li>
<li>Postconditions: Let <tt class="docutils literal">N == <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal">size()</tt> is <tt class="docutils literal">N</tt> more, <tt class="docutils literal">from.size()</tt> is <tt class="docutils literal">N</tt> less.</li>
<li>Exception safety: Basic guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r,</span> <span class="pre">ptr_multimap_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Range &gt; void transfer( const Range&amp; r, ptr_multimap_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> <span class="pre">from</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">transfer( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">ptr_multimap_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( ptr_multimap_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(</span> <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> <span class="pre">from</span> <span class="pre">);</span></tt>.</li>
<li>Effects: <tt class="docutils literal">transfer( <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> from );</tt>.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">from.empty();</span></tt></li>
<li>Exception safety: Basic guarantee</li>
</ul>
@@ -470,7 +544,7 @@ is propagated to the pointer (that is, to <tt class="docutils literal"><span cla
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -61,7 +61,7 @@ of the interface from ``associative_ptr_container``.
public: // `modifiers`_
iterator insert( key_type& k, T* x );
template< class U >
iterator insert( const key_type&, std::auto_ptr<U> x );
iterator insert( const key_type&, compatible-smart-ptr<U> x );
public: // `pointer container requirements`_
void transfer( iterator object, ptr_multimap_adapter& from );
@@ -123,7 +123,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > iterator insert( const key_type& k, std::auto_ptr<U> x );``
- ``template< class U > iterator insert( const key_type& k, compatible-smart-ptr<U> x );``
- Equivalent to (but without the ``const_cast``): ``return insert( const_cast<key_type&>(k), x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,23 +362,24 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-multiset-adapter" name="class-ptr-multiset-adapter">Class <tt class="docutils literal"><span class="pre">ptr_multiset_adapter</span></tt></a></h1>
<div class="section" id="class-ptr-multiset-adapter">
<h1>Class <tt class="docutils literal">ptr_multiset_adapter</tt></h1>
<p>This class is used to build custom pointer containers with
an underlying multiset-like container. The interface of the class is an extension
of the interface from <tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt>.</p>
of the interface from <tt class="docutils literal">associative_ptr_container</tt>.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><tt class="docutils literal"><span class="pre">ptr_multiset_adapter</span></tt></li>
<li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><tt class="docutils literal">ptr_multiset_adapter</tt></li>
<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference external" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference external" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference external" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li>
</ul>
</li>
</ul>
@@ -315,28 +389,28 @@ of the interface from <tt class="docutils literal"><span class="pre">associative
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
template
&lt;
&lt;
class Key,
class VoidPtrMultiSet,
class CloneAllocator = heap_clone_allocator
&gt;
class ptr_multiset_adapter
class ptr_multiset_adapter
{
public: // <a class="reference" href="#modifiers">modifiers</a>
iterator insert( Key* x );
template&lt; class Key2 &gt;
iterator insert( std::auto_ptr&lt;Key2&gt; x );
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
iterator insert( Key* x );
template&lt; class Key2 &gt;
iterator insert( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;Key2&gt; x );
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
void transfer( iterator object, ptr_multiset_adapter&amp; from );
size_type transfer( iterator first, iterator last, ptr_multiset_adapter&amp; from );
template&lt; class Range &gt;
@@ -345,28 +419,28 @@ namespace boost
}; // class 'ptr_multiset_adapter'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">key_type*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator insert( key_type* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal"><span class="pre">x</span></tt>. The returned iterator points to the element with key <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal">x</tt>. The returned iterator points to the element with key <tt class="docutils literal">x</tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Key2</span> <span class="pre">&gt;</span> <span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">std::auto_ptr&lt;Key2&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Key2 &gt; iterator insert( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;Key2&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">insert(</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return insert( x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -377,40 +451,40 @@ namespace boost
- Exception safety: Strong guarantee -->
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">object,</span> <span class="pre">ptr_multiset_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator object, ptr_multiset_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal"><span class="pre">object</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is one less.</li>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one more, <tt class="docutils literal">from.size()</tt> is one less.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr_multiset_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator first, iterator last, ptr_multiset_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal"><span class="pre">[first,last)</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.</li>
<li>Postconditions: Let <tt class="docutils literal"><span class="pre">N</span> <span class="pre">==</span> <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal"><span class="pre">size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> less.</li>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li>
<li>Postconditions: Let <tt class="docutils literal">N == <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal">size()</tt> is <tt class="docutils literal">N</tt> more, <tt class="docutils literal">from.size()</tt> is <tt class="docutils literal">N</tt> less.</li>
<li>Exception safety: Basic guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r,</span> <span class="pre">ptr_multiset_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Range &gt; void transfer( const Range&amp; r, ptr_multiset_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> <span class="pre">from</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">transfer( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">ptr_multiset_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( ptr_multiset_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(</span> <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> <span class="pre">from</span> <span class="pre">);</span></tt>.</li>
<li>Effects: <tt class="docutils literal">transfer( <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> from );</tt>.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">from.empty();</span></tt></li>
<li>Exception safety: Basic guarantee</li>
</ul>
@@ -421,7 +495,7 @@ namespace boost
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -51,7 +51,7 @@ of the interface from ``associative_ptr_container``.
public: // `modifiers`_
iterator insert( Key* x );
template< class Key2 >
iterator insert( std::auto_ptr<Key2> x );
iterator insert( compatible-smart-ptr<Key2> x );
public: // `pointer container requirements`_
void transfer( iterator object, ptr_multiset_adapter& from );
@@ -84,7 +84,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class Key2 > iterator insert( std::auto_ptr<Key2> x );``
- ``template< class Key2 > iterator insert( compatible-smart-ptr<Key2> x );``
- Effects: ``return insert( x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,25 +362,26 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-sequence-adapter" name="class-ptr-sequence-adapter">Class <tt class="docutils literal"><span class="pre">ptr_sequence_adapter</span></tt></a></h1>
<div class="section" id="class-ptr-sequence-adapter">
<h1>Class <tt class="docutils literal">ptr_sequence_adapter</tt></h1>
<p>This section describes all the common operations for all the pointer
sequences:</p>
<ul class="simple">
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
</ul>
<p>The <tt class="docutils literal"><span class="pre">ptr_sequence_adapter</span></tt> is also a concrete class that you can use to create custom pointer
<p>The <tt class="docutils literal">ptr_sequence_adapter</tt> is also a concrete class that you can use to create custom pointer
containers from.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><tt class="docutils literal"><span class="pre">ptr_sequence_adapter</span></tt><ul>
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference" href="ptr_array.html">ptr_array</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><tt class="docutils literal">ptr_sequence_adapter</tt><ul>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference external" href="ptr_array.html">ptr_array</a></li>
</ul>
</li>
</ul>
@@ -315,8 +389,8 @@ containers from.</p>
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
@@ -331,26 +405,26 @@ namespace boost
&gt;
class ptr_sequence_adapter
{
public: // <a class="reference" href="#construct-copy-destroy">construct/copy/destroy</a>
public: // <a class="reference internal" href="#construct-copy-destroy">construct/copy/destroy</a>
template&lt; class InputIterator &gt;
assign( InputIterator first, InputIterator last );
template&lt; class InputRange &gt;
assign( const InputRange&amp; e );
public: // <a class="reference" href="#element-access">element access</a>
public: // <a class="reference internal" href="#element-access">element access</a>
T&amp; front();
const T&amp; front() const;
T&amp; back();
const T&amp; back() const;
public: // <a class="reference" href="#modifiers">modifiers</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
void push_back( T* x );
template&lt; class U &gt;
void push_back( std::auto_ptr&lt;U&gt; x );
void push_back( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
auto_type pop_back();
iterator insert( iterator position, T* x );
template&lt; class U &gt;
iterator insert( iterator position, std::auto_ptr&lt;U&gt; x );
iterator insert( iterator position, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
template&lt; class InputIterator &gt;
void insert( iterator position, InputIterator first, InputIterator last );
template&lt; class InputRange &gt;
@@ -362,10 +436,10 @@ namespace boost
void resize( size_type size );
void resize( size_type size, T* to_clone );
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
template&lt; class PtrSequence &gt;
void transfer( iterator before, typename PtrSequence::iterator object,
PtrSequence&amp; from );
PtrSequence&amp; from );
template&lt; class PtrSequence &gt;
void transfer( iterator before, typename PtrSequence::iterator first, typename PtrSequence::iterator last,
PtrSequence&amp; from );
@@ -374,7 +448,7 @@ namespace boost
template&lt; class PtrSequence &gt;
void transfer( iterator before, PtrSequence&amp; from );
public: // <a class="reference" href="#algorithms">algorithms</a>
public: // <a class="reference internal" href="#algorithms">algorithms</a>
void sort();
void sort( iterator first, iterator last );
@@ -402,38 +476,38 @@ namespace boost
template&lt; class Compare &gt;
void merge( iterator first, iterator last, ptr_sequence_adapter&amp; from, Compare comp );
public: // <a class="reference" href="ptr_list.html">ptr_list interface</a>
public: // <a class="reference external" href="ptr_list.html">ptr_list interface</a>
public: // <a class="reference" href="ptr_vector.html">ptr_vector interface</a>
public: // <a class="reference external" href="ptr_vector.html">ptr_vector interface</a>
public: // <a class="reference" href="ptr_deque.html">ptr_deque interface</a>
public: // <a class="reference external" href="ptr_deque.html">ptr_deque interface</a>
}; // class 'ptr_sequence_adapter'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-construct-copy-destroy" name="semantics-construct-copy-destroy"><span id="construct-copy-destroy"></span>Semantics: construct/copy/destroy</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-construct-copy-destroy">
<span id="construct-copy-destroy"></span><h2>Semantics: construct/copy/destroy</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">InputIterator</span> <span class="pre">&gt;</span>
<span class="pre">void</span> <span class="pre">assign(</span> <span class="pre">InputIterator</span> <span class="pre">first,</span> <span class="pre">InputIterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class InputIterator &gt;
void assign( InputIterator first, InputIterator last );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">(first,last]</span></tt> is a valid range</li>
<li>Effects: <tt class="docutils literal"><span class="pre">clear();</span> <span class="pre">insert(</span> <span class="pre">first,</span> <span class="pre">last</span> <span class="pre">);</span></tt></li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">std::distance(</span> <span class="pre">first,</span> <span class="pre">last</span> <span class="pre">);</span></tt></li>
<li>Requirements: <tt class="docutils literal">(first,last]</tt> is a valid range</li>
<li>Effects: <tt class="docutils literal"><span class="pre">clear();</span> insert( first, last );</tt></li>
<li>Postconditions: <tt class="docutils literal">size() == <span class="pre">std::distance(</span> first, last );</tt></li>
<li>Exception safety: strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">InputRange</span> <span class="pre">&gt;</span>
<span class="pre">void</span> <span class="pre">assign(</span> <span class="pre">const</span> <span class="pre">InputRange&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class InputRange &gt;
void assign( const InputRange&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">assign(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">assign( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> );</tt></li>
</ul>
</blockquote>
</li>
@@ -459,60 +533,60 @@ Postconditions: size() == sz
Exception safety: Strong guarantee -->
</div>
<div class="section">
<h2><a id="semantics-element-access" name="semantics-element-access"><span id="element-access"></span>Semantics: element access</a></h2>
<div class="section" id="semantics-element-access">
<span id="element-access"></span><h2>Semantics: element access</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">front();</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; <span class="pre">front();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*begin();</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*begin();</span></tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">front()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; front() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*begin();</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*begin();</span></tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">back();</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; <span class="pre">back();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*--end();</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*--end();</span></tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">back()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; back() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*--end();</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: <tt class="docutils literal">return <span class="pre">*--end();</span></tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">push_back(</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void push_back( T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Inserts the pointer into container and takes ownership of it</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Throws: <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">push_back(</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; void push_back( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">push_back(</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">push_back( x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -523,32 +597,32 @@ Exception safety: Strong guarantee -->
- Exception safety: Strong guarantee -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">pop_back();</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type <span class="pre">pop_back();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Requirements:<tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty()</span></tt></li>
<li>Requirements:<tt class="docutils literal">not empty()</tt></li>
<li>Effects: Removes the last element in the container</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one less</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if <tt class="docutils literal">empty() == true</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator insert( iterator position, T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">position</span></tt> is a valid iterator from the container and
<tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Inserts <tt class="docutils literal"><span class="pre">x</span></tt> before <tt class="docutils literal"><span class="pre">position</span></tt> and returns an iterator pointing to it</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">position</tt> is a valid iterator from the container and
<tt class="docutils literal">x != 0</tt></li>
<li>Effects: Inserts <tt class="docutils literal">x</tt> before <tt class="docutils literal">position</tt> and returns an iterator pointing to it</li>
<li>Throws: <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">iterator</span> <span class="pre">insert(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; iterator insert( iterator position, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">insert(</span> <span class="pre">position,</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return insert( position, x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -569,185 +643,185 @@ Exception safety: Strong guarantee -->
- Exception safety: Strong guarantee -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">InputIterator</span> <span class="pre">&gt;</span>
<span class="pre">void</span> <span class="pre">insert(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">InputIterator</span> <span class="pre">first,</span> <span class="pre">InputIterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class InputIterator &gt;
void insert( iterator position, InputIterator first, InputIterator last );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">position</span></tt> is a valid iterator from the container</li>
<li>Effects: Inserts a cloned range before <tt class="docutils literal"><span class="pre">position</span></tt></li>
<li>Requirements: <tt class="docutils literal">position</tt> is a valid iterator from the container</li>
<li>Effects: Inserts a cloned range before <tt class="docutils literal">position</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">InputRange</span> <span class="pre">&gt;</span>
<span class="pre">void</span> <span class="pre">insert(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">const</span> <span class="pre">InputRange&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class InputRange &gt;
void insert( iterator position, const InputRange&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">insert(</span> <span class="pre">position,</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">insert( position, <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">erase(</span> <span class="pre">iterator</span> <span class="pre">position</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator erase( iterator position );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">position</span></tt> is a valid iterator from the container</li>
<li>Effects: Removes the element defined by <tt class="docutils literal"><span class="pre">position</span></tt> and returns an iterator to the following element</li>
<li>Requirements: <tt class="docutils literal">position</tt> is a valid iterator from the container</li>
<li>Effects: Removes the element defined by <tt class="docutils literal">position</tt> and returns an iterator to the following element</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">erase(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator erase( iterator first, iterator last );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">[first,last)</span></tt> is a valid range</li>
<li>Effects: Removes the range of element defined by <tt class="docutils literal"><span class="pre">[first,last)</span></tt> and returns an iterator to the following element</li>
<li>Requirements: <tt class="docutils literal">[first,last)</tt> is a valid range</li>
<li>Effects: Removes the range of element defined by <tt class="docutils literal">[first,last)</tt> and returns an iterator to the following element</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span>
<span class="pre">void</span> <span class="pre">erase(</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Range &gt;
void erase( const Range&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">erase(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">erase( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r)</span> );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">resize(</span> <span class="pre">size_type</span> <span class="pre">size</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void resize( size_type size );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Resizes the container. If elements are erased, it happens from the back. If elements are inserted, it happens at the back.</li>
<li>Requirements: <tt class="docutils literal"><span class="pre">T</span></tt> is default constructible</li>
<li>Postcondition: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">size;</span></tt></li>
<li>Requirements: <tt class="docutils literal">T</tt> is default constructible</li>
<li>Postcondition: <tt class="docutils literal">size() == size;</tt></li>
<li>Exception safety: Basic guarantee under expansion; nothrow guarantee otherwise</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">resize(</span> <span class="pre">size_type</span> <span class="pre">size,</span> <span class="pre">T*</span> <span class="pre">to_clone</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void resize( size_type size, T* to_clone );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Resizes the container. If elements are erased, it happens from the back. If elements are inserted, clones of <tt class="docutils literal"><span class="pre">*to_clone</span></tt> are inserted at the back.</li>
<li>Postcondition: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">size;</span></tt></li>
<li>Effects: Resizes the container. If elements are erased, it happens from the back. If elements are inserted, clones of <tt class="docutils literal">*to_clone</tt> are inserted at the back.</li>
<li>Postcondition: <tt class="docutils literal">size() == size;</tt></li>
<li>Exception safety: Basic guarantee under expansion; nothrow guarantee otherwise</li>
<li>Remarks: <tt class="docutils literal"><span class="pre">to_clone</span> <span class="pre">==</span> <span class="pre">0</span></tt> is valid if the container supports nulls. The container does not take ownership of <tt class="docutils literal"><span class="pre">to_clone</span></tt>.</li>
<li>Remarks: <tt class="docutils literal">to_clone == 0</tt> is valid if the container supports nulls. The container does not take ownership of <tt class="docutils literal">to_clone</tt>.</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<p>You can use <tt class="docutils literal"><span class="pre">transfer()</span></tt> to move elements between two containers of the same type. Furthermore,
you can also move elements from a container of type <tt class="docutils literal"><span class="pre">T</span></tt> to a container of type <tt class="docutils literal"><span class="pre">U</span></tt> as long as
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<p>You can use <tt class="docutils literal">transfer()</tt> to move elements between two containers of the same type. Furthermore,
you can also move elements from a container of type <tt class="docutils literal">T</tt> to a container of type <tt class="docutils literal">U</tt> as long as
<tt class="docutils literal"><span class="pre">T::value_type</span></tt> is convertible to <tt class="docutils literal"><span class="pre">U::value_type</span></tt>. An example would be transferring from <tt class="docutils literal"><span class="pre">boost::ptr_vector&lt;Derived&gt;</span></tt>
to <tt class="docutils literal"><span class="pre">boost::ptr_deque&lt;Base&gt;</span></tt>.</p>
<p>(<strong>Remark:</strong> <em>When moving elements between two different containers, it is your responsibility to make sure the allocators are compatible.</em>
<p>(<strong>Remark:</strong> <em>When moving elements between two different containers, it is your responsibility to make sure the allocators are compatible.</em>
<em>The special latitude of being able to transfer between two different containers is only available for Sequences and not for Associative Containers.</em>)</p>
<!-- -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">PtrSequence</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">before,</span> <span class="pre">typename</span> <span class="pre">PtrSequence::iterator</span> <span class="pre">object,</span> <span class="pre">PtrSequence&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class PtrSequence &gt; void transfer( iterator before, typename <span class="pre">PtrSequence::iterator</span> object, PtrSequence&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Inserts the object defined by <tt class="docutils literal"><span class="pre">object</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.
Insertion takes place before <tt class="docutils literal"><span class="pre">before</span></tt>.</li>
<li>Postconditions: If <tt class="docutils literal"><span class="pre">from.empty()</span></tt>, nothing happens. Otherwise
<tt class="docutils literal"><span class="pre">size()</span></tt> is one more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is one less.</li>
<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>.
Insertion takes place before <tt class="docutils literal">before</tt>.</li>
<li>Postconditions: If <tt class="docutils literal">from.empty()</tt>, nothing happens. Otherwise
<tt class="docutils literal">size()</tt> is one more, <tt class="docutils literal">from.size()</tt> is one less.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">PtrSequence</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">before,</span> <span class="pre">typename</span> <span class="pre">PtrSequence::iterator</span> <span class="pre">first,</span> <span class="pre">typename</span> <span class="pre">PtrSequence::iterator</span> <span class="pre">last,</span> <span class="pre">PtrSequence&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class PtrSequence &gt; void transfer( iterator before, typename <span class="pre">PtrSequence::iterator</span> first, typename <span class="pre">PtrSequence::iterator</span> last, PtrSequence&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">from.size()</span> <span class="pre">&gt;=</span> <span class="pre">std::distance(first,last)</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal"><span class="pre">[first,last)</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.
Insertion takes place before <tt class="docutils literal"><span class="pre">before</span></tt>.</li>
<li>Postconditions: If <tt class="docutils literal"><span class="pre">from.empty()</span></tt>, nothing happens. Otherwise,
let <tt class="docutils literal"><span class="pre">N</span> <span class="pre">==</span> <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal"><span class="pre">size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> more, <tt class="docutils literal"><span class="pre">from.size()</span></tt> is <tt class="docutils literal"><span class="pre">N</span></tt> less.</li>
<li>Requirements: <tt class="docutils literal">from.size() &gt;= <span class="pre">std::distance(first,last)</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.
Insertion takes place before <tt class="docutils literal">before</tt>.</li>
<li>Postconditions: If <tt class="docutils literal">from.empty()</tt>, nothing happens. Otherwise,
let <tt class="docutils literal">N == <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal">size()</tt> is <tt class="docutils literal">N</tt> more, <tt class="docutils literal">from.size()</tt> is <tt class="docutils literal">N</tt> less.</li>
<li>Exception safety: Strong guarantee</li>
<li>Complexity: Linear or better</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">PtrSequence,</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">before,</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r,</span> <span class="pre">PtrSequence&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void template&lt; class PtrSequence, class Range &gt; void transfer( iterator before, const Range&amp; r, PtrSequence&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(before,</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> <span class="pre">from);</span></tt></li>
<li>Effects: <tt class="docutils literal">transfer(before, <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from);</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">PtrSequence&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">before,</span> <span class="pre">PtrSequence&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class PtrSequence&gt; void transfer( iterator before, PtrSequence&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">transfer(before,</span> <span class="pre">from,</span> <span class="pre">from);</span></tt></li>
<li>Effects: <tt class="docutils literal">transfer(before, from, from);</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-algorithms" name="semantics-algorithms"><span id="algorithms"></span>Semantics: algorithms</a></h2>
<div class="section" id="semantics-algorithms">
<span id="algorithms"></span><h2>Semantics: algorithms</h2>
<p>The general requirement for these algorithms is that the container <em>does not
contain any nulls</em>.</p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">sort();</span></tt></p>
<li><p class="first"><tt class="docutils literal">void <span class="pre">sort();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">sort(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void sort( iterator first, iterator last );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">sort(</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void sort( Compare comp );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">sort(</span> <span class="pre">iterator</span> <span class="pre">begin,</span> <span class="pre">iterator</span> <span class="pre">end,</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void sort( iterator begin, iterator end, Compare comp );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: (versions without <tt class="docutils literal"><span class="pre">Compare</span></tt>) <tt class="docutils literal"><span class="pre">bool</span> <span class="pre">operator&lt;(</span> <span class="pre">const</span> <span class="pre">T&amp;,</span> <span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">)</span></tt> is defined</li>
<li>Requirements: (<tt class="docutils literal"><span class="pre">Compare</span></tt> versions) <tt class="docutils literal"><span class="pre">Compare</span></tt> must take <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span></tt> arguments</li>
<li>Requirements: (versions without <tt class="docutils literal">Compare</tt>) <tt class="docutils literal">bool operator&lt;( const T&amp;, const T&amp; )</tt> is defined</li>
<li>Requirements: (<tt class="docutils literal">Compare</tt> versions) <tt class="docutils literal">Compare</tt> must take <tt class="docutils literal">const T&amp;</tt> arguments</li>
<li>Effects: sorts the entire container or the specified range</li>
<li>Exception safety: nothrow guarantee (the behavior is undefined if the comparison operator throws)</li>
<li>Remarks: The versions of <tt class="docutils literal"><span class="pre">sort()</span></tt> that take two iterators are not available for <tt class="docutils literal"><span class="pre">ptr_list</span></tt></li>
<li>Remarks: The versions of <tt class="docutils literal">sort()</tt> that take two iterators are not available for <tt class="docutils literal">ptr_list</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">unique();</span></tt></p>
<li><p class="first"><tt class="docutils literal">void <span class="pre">unique();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">unique(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void unique( iterator first, iterator last );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">unique(</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void unique( Compare comp );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">unique(</span> <span class="pre">iterator</span> <span class="pre">begin,</span> <span class="pre">iterator</span> <span class="pre">end,</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void unique( iterator begin, iterator end, Compare comp );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: (versions without <tt class="docutils literal"><span class="pre">Compare</span></tt>) <tt class="docutils literal"><span class="pre">bool</span> <span class="pre">operator==(</span> <span class="pre">const</span> <span class="pre">T&amp;,</span> <span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">)</span></tt> is defined</li>
<li>Requirements: (<tt class="docutils literal"><span class="pre">Compare</span></tt> versions) <tt class="docutils literal"><span class="pre">Compare</span></tt> must take <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span></tt> arguments</li>
<li>Requirements: (versions without <tt class="docutils literal">Compare</tt>) <tt class="docutils literal">bool <span class="pre">operator==(</span> const T&amp;, const T&amp; )</tt> is defined</li>
<li>Requirements: (<tt class="docutils literal">Compare</tt> versions) <tt class="docutils literal">Compare</tt> must take <tt class="docutils literal">const T&amp;</tt> arguments</li>
<li>Effects: removes adjacent and equal objects from the entire container or the specified range</li>
<li>Exception safety: nothrow guarantee (the behavior is undefined if the comparison operator throws)</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Pred</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">erase_if(</span> <span class="pre">Pred</span> <span class="pre">pred</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Pred &gt; void erase_if( Pred pred );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Pred</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">erase_if(</span> <span class="pre">iterator</span> <span class="pre">begin,</span> <span class="pre">iterator</span> <span class="pre">end,</span> <span class="pre">Pred</span> <span class="pre">pred</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Pred &gt; void erase_if( iterator begin, iterator end, Pred pred );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">Pred</span></tt> must take an <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span></tt> argument</li>
<li>Effects: removes all elements <tt class="docutils literal"><span class="pre">t</span></tt> for which <tt class="docutils literal"><span class="pre">pred(t)</span></tt> returns <tt class="docutils literal"><span class="pre">true</span></tt> from the entire container or the specified range</li>
<li>Requirements: <tt class="docutils literal">Pred</tt> must take an <tt class="docutils literal">const T&amp;</tt> argument</li>
<li>Effects: removes all elements <tt class="docutils literal">t</tt> for which <tt class="docutils literal">pred(t)</tt> returns <tt class="docutils literal">true</tt> from the entire container or the specified range</li>
<li>Exception safety: nothrow guarantee (the behavior is undefined if the comparison operator throws)</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">merge(</span> <span class="pre">ptr_sequence_adapter&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void merge( ptr_sequence_adapter&amp; r );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">merge(</span> <span class="pre">ptr_sequence_adapter&amp;</span> <span class="pre">r,</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void merge( ptr_sequence_adapter&amp; r, Compare comp );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">merge(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr_sequence_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void merge( iterator first, iterator last, ptr_sequence_adapter&amp; from );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Compare</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">merge(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr_sequence_adapter&amp;</span> <span class="pre">from,</span> <span class="pre">Compare</span> <span class="pre">comp</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Compare &gt; void merge( iterator first, iterator last, ptr_sequence_adapter&amp; from, Compare comp );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: (<tt class="docutils literal"><span class="pre">Compare</span></tt> versions) <tt class="docutils literal"><span class="pre">Compare</span></tt> must take <tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span></tt> arguments</li>
<li>Requirements: (<tt class="docutils literal">Compare</tt> versions) <tt class="docutils literal">Compare</tt> must take <tt class="docutils literal">const T&amp;</tt> arguments</li>
<li>Requirements: both sequences are sorted wrt. the same predicate</li>
<li>Effects: transfers the entire container or the specified sequence to the container while
ensuring the new sequence is also sorted</li>
<li>Postconditions: (Container versions) <tt class="docutils literal"><span class="pre">r.empty()</span></tt></li>
<li>Postconditions: (Container versions) <tt class="docutils literal">r.empty()</tt></li>
<li>Exception safety: nothrow guarantee (the behavior is undefined if the comparison operator throws)</li>
</ul>
</blockquote>
@@ -757,7 +831,7 @@ ensuring the new sequence is also sorted</li>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -65,11 +65,11 @@ containers from.
public: // `modifiers`_
void push_back( T* x );
template< class U >
void push_back( std::auto_ptr<U> x );
void push_back( compatible-smart-ptr<U> x );
auto_type pop_back();
iterator insert( iterator position, T* x );
template< class U >
iterator insert( iterator position, std::auto_ptr<U> x );
iterator insert( iterator position, compatible-smart-ptr<U> x );
template< class InputIterator >
void insert( iterator position, InputIterator first, InputIterator last );
template< class InputRange >
@@ -234,7 +234,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > void push_back( std::auto_ptr<U> x );``
- ``template< class U > void push_back( compatible-smart-ptr<U> x );``
- Effects: ``push_back( x.release() );``
@@ -269,7 +269,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class U > iterator insert( iterator position, std::auto_ptr<U> x );``
- ``template< class U > iterator insert( iterator position, compatible-smart-ptr<U> x );``
- Effects: ``return insert( position, x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,23 +362,24 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-set-adapter" name="class-ptr-set-adapter">Class <tt class="docutils literal"><span class="pre">ptr_set_adapter</span></tt></a></h1>
<div class="section" id="class-ptr-set-adapter">
<h1>Class <tt class="docutils literal">ptr_set_adapter</tt></h1>
<p>This class is used to build custom pointer containers with
an underlying set-like container. The interface of the class is an extension
of the interface from <tt class="docutils literal"><span class="pre">associative_ptr_container</span></tt>.</p>
of the interface from <tt class="docutils literal">associative_ptr_container</tt>.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><tt class="docutils literal"><span class="pre">ptr_set_adapter</span></tt></li>
<li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><tt class="docutils literal">ptr_set_adapter</tt></li>
<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference external" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference external" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference external" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li>
</ul>
</li>
</ul>
@@ -315,28 +389,28 @@ of the interface from <tt class="docutils literal"><span class="pre">associative
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
template
&lt;
class Key,
&lt;
class Key,
class VoidPtrSet,
class CloneAllocator = heap_clone_allocator
class CloneAllocator = heap_clone_allocator
&gt;
class ptr_set_adapter
class ptr_set_adapter
{
public: // <a class="reference" href="#modifiers">modifiers</a>
std::pair&lt;iterator,bool&gt; insert( Key* x );
template&lt; class Key2 &gt;
std::pair&lt;iterator,bool&gt; insert( std::auto_ptr&lt;Key2&gt; x );
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#modifiers">modifiers</a>
std::pair&lt;iterator,bool&gt; insert( Key* x );
template&lt; class Key2 &gt;
std::pair&lt;iterator,bool&gt; insert( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;Key2&gt; x );
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
bool transfer( iterator object, ptr_set_adapter&amp; from );
size_type transfer( iterator first, iterator last, ptr_set_adapter&amp; from );
template&lt; class Range &gt;
@@ -345,28 +419,28 @@ namespace boost
}; // class 'ptr_set_adapter'
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::pair&lt;iterator,bool&gt;</span> <span class="pre">insert(</span> <span class="pre">key_type*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::pair&lt;iterator,bool&gt;</span> insert( key_type* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal"><span class="pre">x</span></tt> and insert it if there is no equivalent of it already. The <tt class="docutils literal"><span class="pre">bool</span></tt> part of the return value indicates insertion and the iterator points to the element with key <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Requirements: <tt class="docutils literal">x != 0</tt></li>
<li>Effects: Takes ownership of <tt class="docutils literal">x</tt> and insert it if there is no equivalent of it already. The <tt class="docutils literal">bool</tt> part of the return value indicates insertion and the iterator points to the element with key <tt class="docutils literal">x</tt>.</li>
<li>Throws: bad_pointer if <tt class="docutils literal">x == 0</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Key2</span> <span class="pre">&gt;</span> <span class="pre">std::pair&lt;iterator,bool&gt;</span>&nbsp; <span class="pre">insert(</span> <span class="pre">std::auto_ptr&lt;Key2&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Key2 &gt; <span class="pre">std::pair&lt;iterator,bool&gt;</span>&nbsp; insert( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;Key2&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">insert(</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return insert( x.release() );</tt></li>
</ul>
</blockquote>
</li>
@@ -377,42 +451,42 @@ namespace boost
- Exception safety: Strong guarantee -->
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">object,</span> <span class="pre">ptr_set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool transfer( iterator object, ptr_set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal"><span class="pre">object</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>
iff no equivalent object exists.</li>
<li>Returns: whether the object was transfered</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">first,</span> <span class="pre">iterator</span> <span class="pre">last,</span> <span class="pre">ptr__set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator first, iterator last, ptr__set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">from.empty()</span></tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal"><span class="pre">[first,last)</span></tt> into the container and remove it from <tt class="docutils literal"><span class="pre">from</span></tt>.
<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li>
<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.
An object is only transferred if no equivalent object exists.</li>
<li>Returns: the number of transfered objects</li>
<li>Exception safety: Basic guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Range</span> <span class="pre">&gt;</span> <span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">const</span> <span class="pre">Range&amp;</span> <span class="pre">r,</span> <span class="pre">ptr_set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Range &gt; void transfer( const Range&amp; r, ptr_set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">transfer(</span> <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> <span class="pre">from</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return transfer( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">transfer(</span> <span class="pre">ptr_set_adapter&amp;</span> <span class="pre">from</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type transfer( ptr_set_adapter&amp; from );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">transfer(</span> <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> <span class="pre">from</span> <span class="pre">);</span></tt>.</li>
<li>Effects: <tt class="docutils literal">return transfer( <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> from );</tt>.</li>
</ul>
</blockquote>
</li>
@@ -421,7 +495,7 @@ An object is only transferred if no equivalent object exists.</li>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -55,7 +55,7 @@ of the interface from ``associative_ptr_container``.
public: // `modifiers`_
std::pair<iterator,bool> insert( Key* x );
template< class Key2 >
std::pair<iterator,bool> insert( std::auto_ptr<Key2> x );
std::pair<iterator,bool> insert( compatible-smart-ptr<Key2> x );
public: // `pointer container requirements`_
bool transfer( iterator object, ptr_set_adapter& from );
@@ -87,7 +87,7 @@ Semantics: modifiers
- Exception safety: Strong guarantee
- ``template< class Key2 > std::pair<iterator,bool> insert( std::auto_ptr<Key2> x );``
- ``template< class Key2 > std::pair<iterator,bool> insert( compatible-smart-ptr<Key2> x );``
- Effects: ``return insert( x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,18 +362,19 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-ptr-vector" name="class-ptr-vector">Class <tt class="docutils literal"><span class="pre">ptr_vector</span></tt></a></h1>
<p>A <tt class="docutils literal"><span class="pre">ptr_vector&lt;T&gt;</span></tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">std::vector&lt;void*&gt;</span></tt>
<div class="section" id="class-ptr-vector">
<h1>Class <tt class="docutils literal">ptr_vector</tt></h1>
<p>A <tt class="docutils literal">ptr_vector&lt;T&gt;</tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">std::vector&lt;void*&gt;</span></tt>
to store the pointers.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><tt class="docutils literal"><span class="pre">ptr_vector</span></tt></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference" href="ptr_array.html">ptr_array</a></li>
<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul>
<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><tt class="docutils literal">ptr_vector</tt></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference external" href="ptr_array.html">ptr_array</a></li>
</ul>
</li>
</ul>
@@ -308,17 +382,17 @@ to store the pointers.</p>
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>Synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
{
template
&lt;
class T,
&lt;
class T,
class CloneAllocator = heap_clone_allocator,
class Allocator = std::allocator&lt;void*&gt;
&gt;
@@ -329,53 +403,53 @@ namespace boost
CloneAllocator
&gt;
{
public: // <a class="reference" href="#construction">construction</a>
public: // <a class="reference internal" href="#construction">construction</a>
explicit ptr_vector( size_type to_reserve );
public: // <a class="reference" href="#capacity">capacity</a>
public: // <a class="reference internal" href="#capacity">capacity</a>
size_type capacity() const;
void reserve( size_type n );
public: // <a class="reference" href="#element-access">element access</a>
public: // <a class="reference internal" href="#element-access">element access</a>
T&amp; operator[]( size_type n );
const T&amp; operator[]( size_type n ) const;
T&amp; at( size_type n );
const T&amp; at( size_type n ) const;
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
auto_type replace( size_type idx, T* x );
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
auto_type replace( size_type idx, T* x );
template&lt; class U &gt;
auto_type replace( size_type idx, std::auto_ptr&lt;U&gt; x );
auto_type replace( size_type idx, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
bool is_null( size_type idx ) const;
public: // <a class="reference" href="#c-array-support">C-array support</a>
public: // <a class="reference internal" href="#c-array-support">C-array support</a>
void transfer( iterator before, T** from, size_type size, bool delete_from = true );
T** c_array();
};
} // namespace 'boost'
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-construction" name="semantics-construction"><span id="construction"></span>Semantics: construction</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-construction">
<span id="construction"></span><h2>Semantics: construction</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">explicit</span> <span class="pre">ptr_vector(</span> <span class="pre">size_type</span> <span class="pre">to_reserve</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">explicit ptr_vector( size_type to_reserve );</tt></p>
<blockquote>
<ul class="simple">
<li>constructs an empty vector with a buffer
of size least <tt class="docutils literal"><span class="pre">to_reserve</span></tt></li>
of size least <tt class="docutils literal">to_reserve</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-capacity" name="semantics-capacity"><span id="capacity"></span>Semantics: capacity</a></h2>
<div class="section" id="semantics-capacity">
<span id="capacity"></span><h2>Semantics: capacity</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">capacity()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type capacity() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns the size of the allocated buffer</li>
@@ -383,94 +457,94 @@ of size least <tt class="docutils literal"><span class="pre">to_reserve</span></
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">reserve(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void reserve( size_type n );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;=</span> <span class="pre">max_size()</span></tt></li>
<li>Requirements: <tt class="docutils literal">n &lt;= max_size()</tt></li>
<li>Effects: Expands the allocated buffer</li>
<li>Postcondition: <tt class="docutils literal"><span class="pre">capacity()</span> <span class="pre">&gt;=</span> <span class="pre">n</span></tt></li>
<li>Throws: <tt class="docutils literal"><span class="pre">std::length_error()</span></tt> if <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&gt;</span> <span class="pre">max_size()</span></tt></li>
<li>Postcondition: <tt class="docutils literal">capacity() &gt;= n</tt></li>
<li>Throws: <tt class="docutils literal"><span class="pre">std::length_error()</span></tt> if <tt class="docutils literal">n &gt; max_size()</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-element-access" name="semantics-element-access"><span id="element-access"></span>Semantics: element access</a></h2>
<div class="section" id="semantics-element-access">
<span id="element-access"></span><h2>Semantics: element access</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; <span class="pre">operator[](</span> size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; <span class="pre">operator[](</span> size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">T&amp; at( size_type n );</tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&amp;</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const T&amp; at( size_type n ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&gt;=</span> <span class="pre">size()</span></tt></li>
<li>Requirements: <tt class="docutils literal">n &lt; size()</tt></li>
<li>Effects: Returns a reference to the <tt class="docutils literal">n</tt>'th element</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">n &gt;= size()</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_type</span> <span class="pre">idx,</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type replace( size_type idx, T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: `` x != 0 and idx &lt; size()``</li>
<li>Effects: returns the object indexed by <tt class="docutils literal"><span class="pre">idx</span></tt> and replaces it with <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_index</span></tt> if <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&gt;=</span> <span class="pre">size()</span></tt> and <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt>.</li>
<li>Effects: returns the object indexed by <tt class="docutils literal">idx</tt> and replaces it with <tt class="docutils literal">x</tt>.</li>
<li>Throws: <tt class="docutils literal">bad_index</tt> if <tt class="docutils literal">idx &gt;= size()</tt> and <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt>.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">size_type</span> <span class="pre">idx,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; auto_type replace( size_type idx, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace(</span> <span class="pre">idx,</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return replace( idx, x.release() );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">is_null(</span> <span class="pre">size_type</span> <span class="pre">idx</span> <span class="pre">)</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool is_null( size_type idx ) const;</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li>
<li>Requirements: <tt class="docutils literal">idx &lt; size()</tt></li>
<li>Effects: returns whether the pointer at index <tt class="docutils literal">idx</tt> is null</li>
<li>Exception safety: Nothrow guarantee</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-c-array-support" name="semantics-c-array-support"><span id="c-array-support"></span>Semantics: C-array support</a></h2>
<div class="section" id="semantics-c-array-support">
<span id="c-array-support"></span><h2>Semantics: C-array support</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">transfer(</span> <span class="pre">iterator</span> <span class="pre">before,</span> <span class="pre">T**</span> <span class="pre">from,</span> <span class="pre">size_type</span> <span class="pre">size,</span> <span class="pre">bool</span> <span class="pre">delete_from</span> <span class="pre">=</span> <span class="pre">true</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void transfer( iterator before, T** from, size_type size, bool delete_from = true );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">from</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: Takes ownership of the dynamic array <tt class="docutils literal"><span class="pre">from</span></tt></li>
<li>Exception safety: Strong guarantee if <tt class="docutils literal"><span class="pre">delete_from</span> <span class="pre">==</span> <span class="pre">true</span></tt>; if <tt class="docutils literal"><span class="pre">delete_from</span> <span class="pre">==</span> <span class="pre">false</span></tt>,
<li>Requirements: <tt class="docutils literal">from != 0</tt></li>
<li>Effects: Takes ownership of the dynamic array <tt class="docutils literal">from</tt></li>
<li>Exception safety: Strong guarantee if <tt class="docutils literal">delete_from == true</tt>; if <tt class="docutils literal">delete_from == false</tt>,
and an exception is thrown, the container fails to take ownership.</li>
<li>Remarks: Eventually calls <tt class="docutils literal"><span class="pre">delete[]</span> <span class="pre">from</span></tt> if <tt class="docutils literal"><span class="pre">delete_from</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</li>
<li>Remarks: Eventually calls <tt class="docutils literal">delete[] from</tt> if <tt class="docutils literal">delete_from == true</tt>.</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">T**</span> <span class="pre">c_array();</span></tt></p>
<li><p class="first"><tt class="docutils literal">T** <span class="pre">c_array();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Returns: <tt class="docutils literal"><span class="pre">0</span></tt> if the container is empty; otherwise a pointer to the first element of the stored array</li>
<li>Returns: <tt class="docutils literal">0</tt> if the container is empty; otherwise a pointer to the first element of the stored array</li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
@@ -480,7 +554,7 @@ and an exception is thrown, the container fails to take ownership.</li>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -62,7 +62,7 @@ to store the pointers.
public: // `pointer container requirements`_
auto_type replace( size_type idx, T* x );
template< class U >
auto_type replace( size_type idx, std::auto_ptr<U> x );
auto_type replace( size_type idx, compatible-smart-ptr<U> x );
bool is_null( size_type idx ) const;
public: // `C-array support`_
@@ -148,7 +148,7 @@ Semantics: pointer container requirements
- Exception safety: Strong guarantee
- ``template< class U > auto_type replace( size_type idx, std::auto_ptr<U> x );``
- ``template< class U > auto_type replace( size_type idx, compatible-smart-ptr<U> x );``
- Effects: ``return replace( idx, x.release() );``

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -289,29 +362,30 @@ ul.auto-toc {
<body>
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<div class="section">
<h1><a id="class-reversible-ptr-container" name="class-reversible-ptr-container">Class <tt class="docutils literal"><span class="pre">reversible_ptr_container</span></tt></a></h1>
<p>This class is not a real class that can be found in the library.
<div class="section" id="class-reversible-ptr-container">
<h1>Class <tt class="docutils literal">reversible_ptr_container</tt></h1>
<p>This class is not a real class that can be found in the library.
Its purpose is to present the general interface of all the pointer containers.</p>
<p><strong>Hierarchy:</strong></p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">reversible_ptr_container</span></tt><ul>
<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference" href="ptr_array.html">ptr_array</a></li>
<li><tt class="docutils literal">reversible_ptr_container</tt><ul>
<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li>
<li><a class="reference external" href="ptr_list.html">ptr_list</a></li>
<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li>
<li><a class="reference external" href="ptr_array.html">ptr_array</a></li>
</ul>
</li>
<li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul>
<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
<li><a class="reference external" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
<li><a class="reference external" href="ptr_set.html">ptr_set</a></li>
<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li>
<li><a class="reference external" href="ptr_map.html">ptr_map</a></li>
<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li>
</ul>
</li>
</ul>
@@ -321,52 +395,52 @@ Its purpose is to present the general interface of all the pointer containers.</
</ul>
<p><strong>Navigate:</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="reference.html">reference</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="reference.html">reference</a></li>
</ul>
<p><strong>synopsis:</strong></p>
<pre class="literal-block">
namespace boost
{
{
template
&lt;
class T,
&lt;
class T,
class CloneAllocator,
class VoidPtrContainer
&gt;
class reversible_ptr_container
class reversible_ptr_container
{
public: // <a class="reference" href="#typedefs">typedefs</a>
public: // <a class="reference internal" href="#typedefs">typedefs</a>
typedef T* value_type;
typedef T&amp; reference;
typedef const T&amp; const_reference;
typedef <em>implementation defined</em> iterator;
typedef <em>implementation defined</em> const_iterator;
typedef typename VoidPtrContainer::differnce_type difference_type;
typedef typename VoidPtrContainer::differnce_type difference_type;
typedef typename VoidPtrContainer::size_type size_type;
typedef typename VoidPtrContainer::allocator_type allocator_type;
typedef <em>implementation defined</em> reverse_iterator;
typedef <em>implementation defined</em> const_reverse_iterator;
typedef <em>implementation defined</em> auto_type;
public: // <a class="reference" href="#construct-copy-destroy">construct/copy/destroy</a>
public: // <a class="reference internal" href="#construct-copy-destroy">construct/copy/destroy</a>
reversible_ptr_container();
explicit reversible_ptr_container( const reversible_ptr_container&amp; r );
explicit reversible_ptr_container( const reversible_ptr_container&amp; r );
template&lt; class Derived &gt;
explicit reversible_ptr_container( const reversible_ptr_container&lt;Derived&gt;&amp; r );
explicit reversible_ptr_container( std::auto_ptr&lt;reversible_ptr_container&gt; r );
explicit reversible_ptr_container( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;reversible_ptr_container&gt; r );
template&lt; class InputIterator &gt;
reversible_ptr_container( InputIterator first, InputIterator last );
~reversible_ptr_container();
reversible_ptr_container&amp; operator=( const reversible_ptr_container&amp; r );
template&lt;class Derived&gt;
reversible_ptr_container&amp; operator=( const reversible_ptr_container&lt;Derived&gt;&amp; r );
reversible_ptr_container&amp; operator=( std::auto_ptr&lt;reversible_ptr_container&gt; r );
allocator_type get_allocator() const;
public: // <a class="reference" href="#iterators">iterators</a>
reversible_ptr_container&amp; operator=( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;reversible_ptr_container&gt; r );
allocator_type get_allocator() const;
public: // <a class="reference internal" href="#iterators">iterators</a>
iterator begin();
const_iterator begin() const;
iterator end();
@@ -375,49 +449,49 @@ namespace boost
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
public: // <a class="reference" href="#capacity">capacity</a>
public: // <a class="reference internal" href="#capacity">capacity</a>
size_type size() const;
size_type max_size() const;
bool empty() const;
public: // <a class="reference" href="#modifiers">modifiers</a>
bool empty() const;
public: // <a class="reference internal" href="#modifiers">modifiers</a>
void swap( reversible_ptr_container&amp; r );
void clear():
VoidPtrContainer&amp; base();
const VoidPtrContainer&amp; base() const;
public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a>
auto_type replace( iterator position, T* x );
template&lt; class U &gt;
auto_type replace( iterator position, std::auto_ptr&lt;U&gt; x );
std::auto_ptr&lt;reversible_ptr_container&gt; clone() const;
std::auto_ptr&lt;reversible_ptr_container&gt; release();
auto_type replace( iterator position, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt; x );
<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;reversible_ptr_container&gt; clone() const;
<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;reversible_ptr_container&gt; release();
auto_type release( iterator position );
}; // class 'reversible_ptr_container'
// <a class="reference" href="#comparison">comparison</a>
// <a class="reference internal" href="#comparison">comparison</a>
template &lt; class T, class CA, class VPC &gt;
bool operator==( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
template &lt; class T, class CA, class VPC &gt;
bool operator&lt;( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
template &lt; class T, class CA, class VPC &gt;
bool operator!=( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
template &lt; class T, class CA, class VPC &gt;
bool operator&gt;( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
template &lt; class T, class CA, class VPC &gt;
bool operator&gt;=( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
template &lt; class T, class CA, class VPC &gt;
bool operator&lt;=( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y);
@@ -426,16 +500,16 @@ namespace boost
void swap( reversible_ptr_container&lt;T,CA,VPC&gt;&amp; x,
reversible_ptr_container&lt;T,CA,VPC&gt;&amp; y );
// <a class="reference" href="#cloneability">cloneability</a>
// <a class="reference internal" href="#cloneability">cloneability</a>
template&lt; class T, class CA, class VPC &gt;
reversible_ptr_container&lt;T,CA,VPC&gt;*
new_clone( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; r );
// <a class="reference" href="#null-predicate">null predicate</a>
// <a class="reference internal" href="#null-predicate">null predicate</a>
template&lt; class Iterator &gt;
bool is_null( Iterator i );
// <a class="reference" href="#serialization">serialization</a>
// <a class="reference internal" href="#serialization">serialization</a>
template&lt;class Archive, class T, class CA, class VPC&gt;
void serialize( Archive&amp; ar, reversible_ptr_container&lt;T,CÁ,VPC&gt;&amp; c, const unsigned int version );
@@ -443,20 +517,20 @@ namespace boost
} // namespace 'boost'
</pre>
</div>
<div class="section">
<h1><a id="semantics" name="semantics">Semantics</a></h1>
<div class="section">
<h2><a id="semantics-typedefs" name="semantics-typedefs"><span id="typedefs"></span>Semantics: typedefs</a></h2>
<div class="section" id="semantics">
<h1>Semantics</h1>
<div class="section" id="semantics-typedefs">
<span id="typedefs"></span><h2>Semantics: typedefs</h2>
<p>Notice how these two types differ:</p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">T*</span> <span class="pre">value_type;</span></tt></p>
<li><p class="first"><tt class="docutils literal">typedef T* value_type;</tt></p>
<blockquote>
<ul class="simple">
<li>notice this has pointer type</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">T&amp;</span> <span class="pre">reference;</span></tt></p>
<li><p class="first"><tt class="docutils literal">typedef T&amp; reference;</tt></p>
<blockquote>
<ul class="simple">
<li>notice this is not a pointer type</li>
@@ -471,19 +545,19 @@ to the container, but to hide the pointers externally.</p>
- this is ``std::pair<const Key, void*>`` for maps -->
<p>Also notice that</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">iterator</span></tt></li>
<li><tt class="docutils literal">typedef ... iterator</tt></li>
</ul>
<p>allows one to iterate over <tt class="docutils literal"><span class="pre">T&amp;</span></tt> objects, not <tt class="docutils literal"><span class="pre">T*</span></tt>.
<p>allows one to iterate over <tt class="docutils literal">T&amp;</tt> objects, not <tt class="docutils literal">T*</tt>.
Note that:</p>
<pre class="literal-block">
iterator i = ...;
i.base();
</pre>
<p>returns an iterator that allows one to iterate over <tt class="docutils literal"><span class="pre">void*</span></tt>
<p>returns an iterator that allows one to iterate over <tt class="docutils literal">void*</tt>
elements (<em>this is very rarely needed and you should not use the
functionality unless you know what you are doing</em>).</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">auto_type</span></tt></li>
<li><tt class="docutils literal">typedef ... auto_type</tt></li>
</ul>
<p>This declaration hides a pointer pointer type. You can rely on the following
operations</p>
@@ -495,9 +569,9 @@ T* release();
operator <em>implementation-defined bool</em>();
</pre>
<p>The destructor will delete the stored object <em>using the clone allocator of the container</em>
(this explains why we cannot use <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt>). It might help to
think it is just an <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt>. You can also return
the pointer from a function or assign it to another pointer via the <tt class="docutils literal"><span class="pre">move()</span></tt>
(this explains why we cannot use <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;T&gt;</span></tt> nor <tt class="docutils literal"><span class="pre">std::unique_ptr&lt;T&gt;</span></tt>). It might help to
think it is just a <tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;T&gt;</span></tt>. You can also return
the pointer from a function or assign it to another pointer via the <tt class="docutils literal">move()</tt>
function</p>
<pre class="literal-block">
auto_type ptr = ...;
@@ -505,14 +579,14 @@ auto_type other = boost::ptr_container::move( ptr );
return boost::ptr_container::move( other );
</pre>
</div>
<div class="section">
<h2><a id="semantics-construct-copy-destroy" name="semantics-construct-copy-destroy"><span id="construct-copy-destroy"></span>Semantics: construct/copy/destroy</a></h2>
<div class="section" id="semantics-construct-copy-destroy">
<span id="construct-copy-destroy"></span><h2>Semantics: construct/copy/destroy</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Constructs an empty container</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
<li>Postconditions: <tt class="docutils literal">size() == 0</tt></li>
</ul>
</blockquote>
</li>
@@ -523,35 +597,35 @@ return boost::ptr_container::move( other );
- Postconditions: ``size() == n`` -->
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">explicit</span> <span class="pre">reversible_ptr_container(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">explicit reversible_ptr_container( const reversible_ptr_container&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal">r</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Derived</span> <span class="pre">&gt;</span> <span class="pre">explicit</span> <span class="pre">reversible_ptr_container(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&lt;Derived&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Derived &gt; explicit reversible_ptr_container( const reversible_ptr_container&lt;Derived&gt;&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Requirements: <tt class="docutils literal"><span class="pre">Derived</span></tt> is derived from <tt class="docutils literal"><span class="pre">T</span></tt></li>
<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal">r</tt></li>
<li>Requirements: <tt class="docutils literal">Derived</tt> is derived from <tt class="docutils literal">T</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">explicit</span> <span class="pre">reversible_ptr_container(</span> <span class="pre">std::auto_ptr&lt;</span> <span class="pre">reversible_ptr_container</span> <span class="pre">&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">explicit reversible_ptr_container( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;</span> reversible_ptr_container &gt; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Constructs a container by taking ownership of the supplied pointers</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">InputIterator</span> <span class="pre">&gt;</span></tt>
<tt class="docutils literal"><span class="pre">reversible_ptr_container(</span> <span class="pre">InputIterator</span> <span class="pre">first,</span> <span class="pre">InputIterator</span> <span class="pre">last</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class InputIterator &gt;</tt>
<tt class="docutils literal">reversible_ptr_container( InputIterator first, InputIterator last );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">(first,last]</span></tt> is a valid range</li>
<li>Effects: Constructs a container with a cloned range of <tt class="docutils literal"><span class="pre">(first,last]</span></tt></li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">std::distance(</span> <span class="pre">first,</span> <span class="pre">last</span> <span class="pre">)</span></tt></li>
<li>Requirements: <tt class="docutils literal">(first,last]</tt> is a valid range</li>
<li>Effects: Constructs a container with a cloned range of <tt class="docutils literal">(first,last]</tt></li>
<li>Postconditions: <tt class="docutils literal">size() == <span class="pre">std::distance(</span> first, last )</tt></li>
</ul>
</blockquote>
</li>
@@ -563,24 +637,24 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container&amp;</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">reversible_ptr_container&amp; operator=( const reversible_ptr_container&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Effects: Assigns a clone of <tt class="docutils literal">r</tt></li>
<li>Exception safety: strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;class</span> <span class="pre">Derived&gt;</span> <span class="pre">reversible_ptr_container&amp;</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&lt;Derived&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt;class Derived&gt; reversible_ptr_container&amp; operator=( const reversible_ptr_container&lt;Derived&gt;&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li>
<li>Requirements: <tt class="docutils literal"><span class="pre">Derived</span></tt> is derived from <tt class="docutils literal"><span class="pre">T</span></tt></li>
<li>Effects: Assigns a clone of <tt class="docutils literal">r</tt></li>
<li>Requirements: <tt class="docutils literal">Derived</tt> is derived from <tt class="docutils literal">T</tt></li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container&amp;</span> <span class="pre">operator=(</span> <span class="pre">std::auto_ptr&lt;reversible_ptr_container&gt;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">reversible_ptr_container&amp; operator=( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;reversible_ptr_container&gt;</span> r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Deletes the stored objects and then takes ownership of the supplied pointers</li>
@@ -588,7 +662,7 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">allocator_type</span> <span class="pre">get_allocator()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">allocator_type get_allocator() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a copy of the allocator of the container object</li>
@@ -597,56 +671,56 @@ return boost::ptr_container::move( other );
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-iterators" name="semantics-iterators"><span id="iterators"></span>Semantics: iterators</a></h2>
<p><strong>See also:</strong> <a class="reference" href="conventions.html#iterators-are-invalidated-as-in-the-corresponding-standard-container">iterator invalidation</a></p>
<div class="section" id="semantics-iterators">
<span id="iterators"></span><h2>Semantics: iterators</h2>
<p><strong>See also:</strong> <a class="reference external" href="conventions.html#iterators-are-invalidated-as-in-the-corresponding-standard-container">iterator invalidation</a></p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">begin();</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator <span class="pre">begin();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const_iterator</span> <span class="pre">begin()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const_iterator begin() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal"><span class="pre">value_type</span> <span class="pre">T</span></tt></li>
<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal">value_type T</tt></li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">end();</span></tt></p>
<li><p class="first"><tt class="docutils literal">iterator <span class="pre">end();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const_iterator</span> <span class="pre">end()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const_iterator end() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal"><span class="pre">value_type</span> <span class="pre">T</span></tt></li>
<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal">value_type T</tt></li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">reverse_iterator</span> <span class="pre">rbegin();</span></tt></p>
<li><p class="first"><tt class="docutils literal">reverse_iterator <span class="pre">rbegin();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const_reverse_iterator</span> <span class="pre">rbegin()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const_reverse_iterator rbegin() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal"><span class="pre">value_type</span> <span class="pre">T</span></tt></li>
<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal">value_type T</tt></li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">reverse_iterator</span> <span class="pre">rend();</span></tt></p>
<li><p class="first"><tt class="docutils literal">reverse_iterator <span class="pre">rend();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const_reverse_iterator</span> <span class="pre">rend()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const_reverse_iterator rend() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal"><span class="pre">value_type</span> <span class="pre">T</span></tt></li>
<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal">value_type T</tt></li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-capacity" name="semantics-capacity"><span id="capacity"></span>Semantics: capacity</a></h2>
<div class="section" id="semantics-capacity">
<span id="capacity"></span><h2>Semantics: capacity</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">size()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type size() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns the number of stored elements</li>
@@ -654,7 +728,7 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">size_type</span> <span class="pre">max_size()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">size_type max_size() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns the maximum number of stored elements</li>
@@ -662,7 +736,7 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">bool</span> <span class="pre">empty()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">bool empty() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns whether the container is empty or not</li>
@@ -672,10 +746,10 @@ return boost::ptr_container::move( other );
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
<div class="section" id="semantics-modifiers">
<span id="modifiers"></span><h2>Semantics: modifiers</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">swap(</span> <span class="pre">reversible_ptr_container&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">void swap( reversible_ptr_container&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Swaps the content of the two containers</li>
@@ -683,18 +757,18 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">clear();</span></tt></p>
<li><p class="first"><tt class="docutils literal">void <span class="pre">clear();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Destroys all object of the container</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Postconditions: <tt class="docutils literal">empty() == true</tt></li>
<li>Throws: Nothing</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">VoidPtrContainer&amp;</span> <span class="pre">base();</span></tt></p>
<li><p class="first"><tt class="docutils literal">VoidPtrContainer&amp; <span class="pre">base();</span></tt></p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">VoidPtrContainer&amp;</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal">const VoidPtrContainer&amp; base() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Returns: a reference to the wrapped container</li>
@@ -703,27 +777,27 @@ return boost::ptr_container::move( other );
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
<div class="section" id="semantics-pointer-container-requirements">
<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">T*</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type replace( iterator position, T* x );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty()</span> <span class="pre">and</span> <span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
<li>Effects: returns the object pointed to by <tt class="docutils literal"><span class="pre">position</span></tt> and replaces it with <tt class="docutils literal"><span class="pre">x</span></tt>.</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if the container is empty and <tt class="docutils literal"><span class="pre">bad_pointer</span></tt> if <tt class="docutils literal"><span class="pre">x</span> <span class="pre">==</span> <span class="pre">0</span></tt>.</li>
<li>Requirements: <tt class="docutils literal">not empty() and x != 0</tt></li>
<li>Effects: returns the object pointed to by <tt class="docutils literal">position</tt> and replaces it with <tt class="docutils literal">x</tt>.</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if the container is empty and <tt class="docutils literal">bad_pointer</tt> if <tt class="docutils literal">x == 0</tt>.</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">&gt;</span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">iterator</span> <span class="pre">position,</span> <span class="pre">std::auto_ptr&lt;U&gt;</span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class U &gt; auto_type replace( iterator position, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span> x );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace(</span> <span class="pre">position,</span> <span class="pre">x.release()</span> <span class="pre">);</span></tt></li>
<li>Effects: <tt class="docutils literal">return replace( position, x.release() );</tt></li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr&lt;</span> <span class="pre">reversible_ptr_container</span> <span class="pre">&gt;</span> <span class="pre">clone()</span> <span class="pre">const;</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;</span> reversible_ptr_container &gt; clone() const;</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Returns a deep copy of the container</li>
@@ -732,32 +806,32 @@ return boost::ptr_container::move( other );
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr&lt;</span> <span class="pre">reversible_ptr_container</span> <span class="pre">&gt;</span> <span class="pre">release();</span></tt></p>
<li><p class="first"><tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;</span> reversible_ptr_container &gt; <span class="pre">release();</span></tt></p>
<blockquote>
<ul class="simple">
<li>Effects: Releases ownership of the container. This is a useful way of returning a container from a function.</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
<li>Postconditions: <tt class="docutils literal">empty() == true</tt></li>
<li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if the return value cannot be allocated</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">release(</span> <span class="pre">iterator</span> <span class="pre">position</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">auto_type release( iterator position );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li>
<li>Effects: Releases ownership of the pointer referred to by position</li>
<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
<li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if the container is empty</li>
<li>Postconditions: <tt class="docutils literal">size()</tt> is one less</li>
<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if the container is empty</li>
<li>Exception safety: Strong guarantee</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-comparison" name="semantics-comparison"><span id="comparison"></span>Semantics: comparison</a></h2>
<p>These functions compare the underlying range of objects.
<div class="section" id="semantics-comparison">
<span id="comparison"></span><h2>Semantics: comparison</h2>
<p>These functions compare the underlying range of objects.
So</p>
<pre class="literal-block">
operation( const ptr_container&amp; l, const ptr_container&amp; r );
@@ -765,40 +839,40 @@ operation( const ptr_container&amp; l, const ptr_container&amp; r );
<p>has the effect one would expect of normal standard containers. Hence
objects are compared and not the pointers to objects.</p>
</div>
<div class="section">
<h2><a id="semantics-cloneability" name="semantics-cloneability"><span id="cloneability"></span>Semantics: cloneability</a></h2>
<div class="section" id="semantics-cloneability">
<span id="cloneability"></span><h2>Semantics: cloneability</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">T,</span> <span class="pre">class</span> <span class="pre">CloneAllocator</span> <span class="pre">&gt;</span>
<span class="pre">reversible_ptr_container&lt;T,CA,VPC&gt;*</span>
<span class="pre">new_clone(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&lt;T,CA,VPC&gt;&amp;</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class T, class CloneAllocator &gt;
reversible_ptr_container&lt;T,CA,VPC&gt;*
new_clone( const reversible_ptr_container&lt;T,CA,VPC&gt;&amp; r );</tt></p>
<blockquote>
<ul class="simple">
<li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">r.clone().release();</span></tt></li>
<li>Remarks: This function is only defined for concrete <a class="reference" href="ptr_container.html#smart-containers">pointer containers</a>, but not for
<a class="reference" href="ptr_container.html#smart-container-adapters">pointer container adapters</a>.</li>
<li>Effects: <tt class="docutils literal">return <span class="pre">r.clone().release();</span></tt></li>
<li>Remarks: This function is only defined for concrete <a class="reference external" href="ptr_container.html#smart-containers">pointer containers</a>, but not for
<a class="reference external" href="ptr_container.html#smart-container-adapters">pointer container adapters</a>.</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-null-predicate" name="semantics-null-predicate"><span id="null-predicate"></span>Semantics: null predicate</a></h2>
<div class="section" id="semantics-null-predicate">
<span id="null-predicate"></span><h2>Semantics: null predicate</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">template&lt;</span> <span class="pre">class</span> <span class="pre">Iterator</span> <span class="pre">&gt;</span> <span class="pre">bool</span> <span class="pre">is_null(</span> <span class="pre">Iterator</span> <span class="pre">i</span> <span class="pre">);</span></tt></p>
<li><p class="first"><tt class="docutils literal">template&lt; class Iterator &gt; bool is_null( Iterator i );</tt></p>
<blockquote>
<ul class="simple">
<li>Requirements: <tt class="docutils literal"><span class="pre">i</span></tt> is a valid dereferencable iterator</li>
<li>Returns: <tt class="docutils literal"><span class="pre">*i.base()</span> <span class="pre">==</span> <span class="pre">0;</span></tt></li>
<li>Requirements: <tt class="docutils literal">i</tt> is a valid dereferencable iterator</li>
<li>Returns: <tt class="docutils literal">*i.base() == 0;</tt></li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section">
<h2><a id="semantics-serialization" name="semantics-serialization"><span id="serialization"></span>Semantics: serialization</a></h2>
<div class="section" id="semantics-serialization">
<span id="serialization"></span><h2>Semantics: serialization</h2>
<p>All containers can be serialized by means of
<a class="reference" href="../../serialization/index.html">Boost.Serialization</a>. For an overview, see
<a class="reference" href="reference.html#serialization">Serialization of Pointer Containers</a>.</p>
<a class="reference external" href="../../serialization/index.html">Boost.Serialization</a>. For an overview, see
<a class="reference external" href="reference.html#serialization">Serialization of Pointer Containers</a>.</p>
<blockquote>
<pre class="literal-block">
template&lt;class Archive, class T, class CA, class VPC&gt;
@@ -815,7 +889,7 @@ Boost.Serialization</li>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2007. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -70,7 +70,7 @@ Its purpose is to present the general interface of all the pointer containers.
explicit reversible_ptr_container( const reversible_ptr_container& r );
template< class Derived >
explicit reversible_ptr_container( const reversible_ptr_container<Derived>& r );
explicit reversible_ptr_container( std::auto_ptr<reversible_ptr_container> r );
explicit reversible_ptr_container( compatible-smart-ptr<reversible_ptr_container> r );
template< class InputIterator >
reversible_ptr_container( InputIterator first, InputIterator last );
@@ -79,7 +79,7 @@ Its purpose is to present the general interface of all the pointer containers.
reversible_ptr_container& operator=( const reversible_ptr_container& r );
template<class Derived>
reversible_ptr_container& operator=( const reversible_ptr_container<Derived>& r );
reversible_ptr_container& operator=( std::auto_ptr<reversible_ptr_container> r );
reversible_ptr_container& operator=( compatible-smart-ptr<reversible_ptr_container> r );
allocator_type get_allocator() const;
public: // `iterators`_
@@ -106,9 +106,9 @@ Its purpose is to present the general interface of all the pointer containers.
public: // `pointer container requirements`_
auto_type replace( iterator position, T* x );
template< class U >
auto_type replace( iterator position, std::auto_ptr<U> x );
std::auto_ptr<reversible_ptr_container> clone() const;
std::auto_ptr<reversible_ptr_container> release();
auto_type replace( iterator position, compatible-smart-ptr<U> x );
compatible-smart-ptr<reversible_ptr_container> clone() const;
compatible-smart-ptr<reversible_ptr_container> release();
auto_type release( iterator position );
}; // class 'reversible_ptr_container'
@@ -214,9 +214,10 @@ operations
~auto_type();
operator *implementation-defined bool*\ ();
The destructor will delete the stored object *using the clone allocator of the container*
(this explains why we cannot use ``std::auto_ptr<T>``). It might help to
think it is just an ``std::auto_ptr<T>``. You can also return
(this explains why we cannot use ``std::auto_ptr<T>`` nor ``std::unique_ptr<T>``). It might help to
think it is just a ``compatible-smart-ptr<T>``. You can also return
the pointer from a function or assign it to another pointer via the ``move()``
function
@@ -254,7 +255,7 @@ Semantics: construct/copy/destroy
- Requirements: ``Derived`` is derived from ``T``
- ``explicit reversible_ptr_container( std::auto_ptr< reversible_ptr_container > r );``
- ``explicit reversible_ptr_container( compatible-smart-ptr< reversible_ptr_container > r );``
- Effects: Constructs a container by taking ownership of the supplied pointers
@@ -288,7 +289,7 @@ Semantics: construct/copy/destroy
- Exception safety: Strong guarantee
- ``reversible_ptr_container& operator=( std::auto_ptr<reversible_ptr_container> r );``
- ``reversible_ptr_container& operator=( compatible-smart-ptr<reversible_ptr_container> r );``
- Effects: Deletes the stored objects and then takes ownership of the supplied pointers
@@ -400,11 +401,11 @@ Semantics: pointer container requirements
- Exception safety: Strong guarantee
- ``template< class U > auto_type replace( iterator position, std::auto_ptr<U> x );``
- ``template< class U > auto_type replace( iterator position, compatible-smart-ptr<U> x );``
- Effects: ``return replace( position, x.release() );``
- ``std::auto_ptr< reversible_ptr_container > clone() const;``
- ``compatible-smart-ptr< reversible_ptr_container > clone() const;``
- Effects: Returns a deep copy of the container
@@ -412,7 +413,7 @@ Semantics: pointer container requirements
- Complexity: Linear
- ``std::auto_ptr< reversible_ptr_container > release();``
- ``compatible-smart-ptr< reversible_ptr_container > release();``
- Effects: Releases ownership of the container. This is a useful way of returning a container from a function.

View File

@@ -3,15 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Boost Pointer Container Library</title>
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -20,10 +18,17 @@ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
@@ -32,6 +37,14 @@ customize this style sheet.
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
@@ -42,6 +55,10 @@ blockquote.epigraph {
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
@@ -68,7 +85,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -92,7 +109,8 @@ div.dedication p.topic-title {
font-style: normal }
div.figure {
margin-left: 2em }
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
@@ -109,7 +127,7 @@ div.line-block div.line-block {
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
@@ -151,14 +169,52 @@ h2.subtitle {
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right {
clear: right }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.borderless {
border: 0 }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
@@ -213,17 +269,20 @@ p.topic-title {
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
font: inherit }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -250,7 +309,8 @@ span.section-subtitle {
font-size: 80% }
table.citation {
border-left: solid thin gray }
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
@@ -260,7 +320,8 @@ table.docutils {
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
@@ -274,13 +335,25 @@ table.docutils th.field-name, table.docinfo th.docinfo-name {
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
@@ -290,30 +363,31 @@ ul.auto-toc {
<div class="document" id="boost-pointer-container-library">
<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
<h2 class="subtitle" id="tutorial">Tutorial</h2>
<p>The tutorial shows you the most simple usage of the
library. It is assumed that the reader is familiar
with the use of standard containers. Although
the tutorial is devided into sections, it is recommended
that you read it all from top to bottom.</p>
<ul class="simple">
<li><a class="reference" href="#basic-usage">Basic usage</a></li>
<li><a class="reference" href="#indirected-interface">Indirected interface</a></li>
<li><a class="reference" href="#sequence-containers">Sequence containers</a></li>
<li><a class="reference" href="#associative-containers">Associative containers</a></li>
<li><a class="reference" href="#null-values">Null values</a></li>
<li><a class="reference" href="#cloneability">Cloneability</a></li>
<li><a class="reference" href="#new-functions">New functions</a></li>
<li><a class="reference" href="#std-auto-ptr-u-overloads">std::auto_ptr&lt;U&gt; overloads</a></li>
<li><a class="reference" href="#algorithms">Algorithms</a></li>
<li><a class="reference internal" href="#basic-usage">Basic usage</a></li>
<li><a class="reference internal" href="#indirected-interface">Indirected interface</a></li>
<li><a class="reference internal" href="#sequence-containers">Sequence containers</a></li>
<li><a class="reference internal" href="#associative-containers">Associative containers</a></li>
<li><a class="reference internal" href="#null-values">Null values</a></li>
<li><a class="reference internal" href="#cloneability">Cloneability</a></li>
<li><a class="reference internal" href="#new-functions">New functions</a></li>
<li><a class="reference internal" href="#compatible-smart-pointer-overloads">Compatible smart pointer overloads</a></li>
<li><a class="reference internal" href="#algorithms">Algorithms</a></li>
</ul>
<div class="section">
<h1><a id="basic-usage" name="basic-usage">Basic usage</a></h1>
<div class="section" id="basic-usage">
<h1>Basic usage</h1>
<p>The most important aspect of a pointer container is that it manages
memory for you. This means that you in most cases do not need to worry
about deleting memory.</p>
<p>Let us assume that we have an OO-hierarchy of animals</p>
<pre class="literal-block">
class animal : <a class="reference" href="http://www.boost.org/libs/utility/utility.htm#Class_noncopyable">boost::noncopyable</a>
class animal : <a class="reference external" href="http://www.boost.org/libs/utility/utility.htm#Class_noncopyable">boost::noncopyable</a>
{
public:
virtual ~animal() {}
@@ -332,7 +406,7 @@ class bird : public animal
// ...
};
</pre>
<p>Then the managing of the animals is straight-forward. Imagine a
<p>Then the managing of the animals is straight-forward. Imagine a
Zoo:</p>
<pre class="literal-block">
class zoo
@@ -347,7 +421,7 @@ public:
};
</pre>
<p>Notice how we just pass the class name to the container; there
is no <tt class="docutils literal"><span class="pre">*</span></tt> to indicate it is a pointer.
is no <tt class="docutils literal">*</tt> to indicate it is a pointer.
With this declaration we can now say:</p>
<pre class="literal-block">
zoo the_zoo;
@@ -357,8 +431,8 @@ the_zoo.add_animal( new bird(&quot;dodo&quot;) );
<p>Thus we heap-allocate all elements of the container
and never rely on copy-semantics.</p>
</div>
<div class="section">
<h1><a id="indirected-interface" name="indirected-interface">Indirected interface</a></h1>
<div class="section" id="indirected-interface">
<h1>Indirected interface</h1>
<p>A particular feature of the pointer containers is that
the query interface is indirected. For example,</p>
<pre class="literal-block">
@@ -382,20 +456,20 @@ ptr_vec::iterator i = vec.begin();
i-&gt;eat(); // no indirection needed
</pre>
</div>
<div class="section">
<h1><a id="sequence-containers" name="sequence-containers">Sequence containers</a></h1>
<div class="section" id="sequence-containers">
<h1>Sequence containers</h1>
<p>The sequence containers are used when you do not need to
keep an ordering on your elements. You can basically
expect all operations of the normal standard containers
to be available. So, for example, with a <tt class="docutils literal"><span class="pre">ptr_deque</span></tt>
and <tt class="docutils literal"><span class="pre">ptr_list</span></tt> object you can say:</p>
to be available. So, for example, with a <tt class="docutils literal">ptr_deque</tt>
and <tt class="docutils literal">ptr_list</tt> object you can say:</p>
<pre class="literal-block">
boost::ptr_deque&lt;animal&gt; deq;
deq.push_front( new animal );
deq.push_front( new animal );
deq.pop_front();
</pre>
<p>because <tt class="docutils literal"><span class="pre">std::deque</span></tt> and <tt class="docutils literal"><span class="pre">std::list</span></tt> have <tt class="docutils literal"><span class="pre">push_front()</span></tt>
and <tt class="docutils literal"><span class="pre">pop_front()</span></tt> members.</p>
<p>because <tt class="docutils literal"><span class="pre">std::deque</span></tt> and <tt class="docutils literal"><span class="pre">std::list</span></tt> have <tt class="docutils literal">push_front()</tt>
and <tt class="docutils literal">pop_front()</tt> members.</p>
<p>If the standard sequence supports
random access, so does the pointer container; for example:</p>
<pre class="literal-block">
@@ -403,16 +477,16 @@ for( boost::ptr_deque&lt;animal&gt;::size_type i = 0u;
i != deq.size(); ++i )
deq[i].eat();
</pre>
<p>The <tt class="docutils literal"><span class="pre">ptr_vector</span></tt> also allows you to specify the size of
<p>The <tt class="docutils literal">ptr_vector</tt> also allows you to specify the size of
the buffer to allocate; for example</p>
<pre class="literal-block">
boost::ptr_vector&lt;animal&gt; animals( 10u );
</pre>
<p>will reserve room for 10 animals.</p>
</div>
<div class="section">
<h1><a id="associative-containers" name="associative-containers">Associative containers</a></h1>
<p>To keep an ordering on our animals, we could use a <tt class="docutils literal"><span class="pre">ptr_set</span></tt>:</p>
<div class="section" id="associative-containers">
<h1>Associative containers</h1>
<p>To keep an ordering on our animals, we could use a <tt class="docutils literal">ptr_set</tt>:</p>
<pre class="literal-block">
boost::ptr_set&lt;animal&gt; set;
set.insert( new monkey(&quot;bobo&quot;) );
@@ -430,7 +504,7 @@ inline bool operator&lt;( const animal&amp; l, const animal&amp; r )
<p>if we wanted to keep the animals sorted by name.</p>
<p>Maybe you want to keep all the animals in zoo ordered wrt.
their name, but it so happens that many animals have the
same name. We can then use a <tt class="docutils literal"><span class="pre">ptr_multimap</span></tt>:</p>
same name. We can then use a <tt class="docutils literal">ptr_multimap</tt>:</p>
<pre class="literal-block">
typedef boost::ptr_multimap&lt;std::string,animal&gt; zoo_type;
zoo_type zoo;
@@ -441,8 +515,8 @@ zoo.insert( bobo, new elephant(bobo) );
zoo.insert( anna, new whale(anna) );
zoo.insert( anna, new emu(anna) );
</pre>
<p>Note that must create the key as an lvalue
(due to exception-safety issues); the following would not
<p>Note that must create the key as an lvalue
(due to exception-safety issues); the following would not
have compiled</p>
<pre class="literal-block">
zoo.insert( &quot;bobo&quot;, // this is bad, but you get compile error
@@ -455,12 +529,12 @@ boost::ptr_map&lt;std::string,animal&gt; animals;
animals[&quot;bobo&quot;].set_name(&quot;bobo&quot;);
</pre>
<p>This requires a default constructor for animals and
a function to do the initialization, in this case <tt class="docutils literal"><span class="pre">set_name()</span></tt>.</p>
<p>A better alternative is to use <a class="reference" href="../../assign/index.html">Boost.Assign</a>
a function to do the initialization, in this case <tt class="docutils literal">set_name()</tt>.</p>
<p>A better alternative is to use <a class="reference external" href="../../assign/index.html">Boost.Assign</a>
to help you out. In particular, consider</p>
<ul class="simple">
<li><a class="reference" href="../../assign/doc/index.html#ptr_push_back">ptr_push_back(), ptr_push_front(), ptr_insert() and ptr_map_insert()</a></li>
<li><a class="reference" href="../../assign/doc/index.html#ptr_list_of">ptr_list_of()</a></li>
<li><a class="reference external" href="../../assign/doc/index.html#ptr_push_back">ptr_push_back(), ptr_push_front(), ptr_insert() and ptr_map_insert()</a></li>
<li><a class="reference external" href="../../assign/doc/index.html#ptr_list_of">ptr_list_of()</a></li>
</ul>
<p>For example, the above insertion may now be written</p>
<pre class="literal-block">
@@ -473,8 +547,8 @@ ptr_map_insert&lt;whale&gt;( animals )( &quot;anna&quot;, &quot;anna&quot; );
ptr_map_insert&lt;emu&gt;( animals )( &quot;anna&quot;, &quot;anna&quot; );
</pre>
</div>
<div class="section">
<h1><a id="null-values" name="null-values">Null values</a></h1>
<div class="section" id="null-values">
<h1>Null values</h1>
<p>By default, if you try to insert null into a container, an exception
is thrown. If you want to allow nulls, then you must
say so explicitly when declaring the container variable</p>
@@ -497,7 +571,7 @@ for( animals_type::iterator i = animals.begin();
</pre>
<p>If the container support random access, you may also check this as</p>
<pre class="literal-block">
for( animals_type::size_type i = 0u;
for( animals_type::size_type i = 0u;
i != animals.size(); ++i )
{
if( !animals.is_null(i) )
@@ -505,11 +579,11 @@ for( animals_type::size_type i = 0u;
}
</pre>
<p>Note that it is meaningless to insert
null into <tt class="docutils literal"><span class="pre">ptr_set</span></tt> and <tt class="docutils literal"><span class="pre">ptr_multiset</span></tt>.</p>
null into <tt class="docutils literal">ptr_set</tt> and <tt class="docutils literal">ptr_multiset</tt>.</p>
</div>
<div class="section">
<h1><a id="cloneability" name="cloneability">Cloneability</a></h1>
<p>In OO programming it is typical to prohibit copying of objects; the
<div class="section" id="cloneability">
<h1>Cloneability</h1>
<p>In OO programming it is typical to prohibit copying of objects; the
objects may sometimes be allowed to be Cloneable; for example,:</p>
<pre class="literal-block">
animal* animal::clone() const
@@ -517,9 +591,9 @@ animal* animal::clone() const
return do_clone(); // implemented by private virtual function
}
</pre>
<p>If the OO hierarchy thus allows cloning, we need to tell the
<p>If the OO hierarchy thus allows cloning, we need to tell the
pointer containers how cloning is to be done. This is simply
done by defining a free-standing function, <tt class="docutils literal"><span class="pre">new_clone()</span></tt>,
done by defining a free-standing function, <tt class="docutils literal">new_clone()</tt>,
in the same namespace as
the object hierarchy:</p>
<pre class="literal-block">
@@ -537,7 +611,7 @@ zoo_type zoo, another_zoo;
another_zoo.assign( zoo.begin(), zoo.end() );
</pre>
<p>will fill another zoo with clones of the first zoo. Similarly,
<tt class="docutils literal"><span class="pre">insert()</span></tt> can now insert clones into your pointer container</p>
<tt class="docutils literal">insert()</tt> can now insert clones into your pointer container</p>
<pre class="literal-block">
another_zoo.insert( another_zoo.begin(), zoo.begin(), zoo.end() );
</pre>
@@ -560,8 +634,8 @@ boost::ptr_map&lt;std::string,monkey&gt; monkeys = ...;
boost::ptr_map&lt;std::string,animal&gt; animals = monkeys;
</pre>
</div>
<div class="section">
<h1><a id="new-functions" name="new-functions">New functions</a></h1>
<div class="section" id="new-functions">
<h1>New functions</h1>
<p>Given that we know we are working with pointers, a few new functions
make sense. For example, say you want to remove an
animal from the zoo</p>
@@ -571,43 +645,43 @@ the_animal-&gt;eat();
animal* the_animal_ptr = the_animal.release(); // now this is not deleted
zoo.release(2); // for random access containers
</pre>
<p>You can think of <tt class="docutils literal"><span class="pre">auto_type</span></tt> as a non-copyable form of
<p>You can think of <tt class="docutils literal">auto_type</tt> as a non-copyable form of
<tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>. Notice that when you release an object, the
pointer is removed from the container and the containers size
shrinks. For containers that store nulls, we can exploit that
<tt class="docutils literal"><span class="pre">auto_type</span></tt> is convertible to <tt class="docutils literal"><span class="pre">bool</span></tt>:</p>
<tt class="docutils literal">auto_type</tt> is convertible to <tt class="docutils literal">bool</tt>:</p>
<pre class="literal-block">
if( ptr_vector&lt; nullable&lt;T&gt; &gt;::auto_type r = vec.pop_back() )
{
...
}
}
</pre>
<p>You can also release the entire container if you
want to return it from a function</p>
<pre class="literal-block">
std::auto_ptr&lt; boost::ptr_deque&lt;animal&gt; &gt; get_zoo()
<a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt; boost::ptr_deque&lt;animal&gt; &gt; get_zoo()
{
boost::ptr_deque&lt;animal&gt; result;
...
return result.release(); // give up ownership
}
...
boost::ptr_deque&lt;animal&gt; animals = get_zoo();
boost::ptr_deque&lt;animal&gt; animals = get_zoo();
</pre>
<p>Let us assume we want to move an animal object from
one zoo to another. In other words, we want to move the
one zoo to another. In other words, we want to move the
animal and the responsibility of it to another zoo</p>
<pre class="literal-block">
another_zoo.transfer( another_zoo.end(), // insert before end
another_zoo.transfer( another_zoo.end(), // insert before end
zoo.begin(), // insert this animal ...
zoo ); // from this container
</pre>
<p>This kind of &quot;move-semantics&quot; is different from
normal value-based containers. You can think of <tt class="docutils literal"><span class="pre">transfer()</span></tt>
as the same as <tt class="docutils literal"><span class="pre">splice()</span></tt> on <tt class="docutils literal"><span class="pre">std::list</span></tt>.</p>
normal value-based containers. You can think of <tt class="docutils literal">transfer()</tt>
as the same as <tt class="docutils literal">splice()</tt> on <tt class="docutils literal"><span class="pre">std::list</span></tt>.</p>
<p>If you want to replace an element, you can easily do so</p>
<pre class="literal-block">
zoo_type::auto_type old_animal = zoo.replace( zoo.begin(), new monkey(&quot;bibi&quot;) );
zoo_type::auto_type old_animal = zoo.replace( zoo.begin(), new monkey(&quot;bibi&quot;) );
zoo.replace( 2, old_animal.release() ); // for random access containers
</pre>
<p>A map is slightly different to iterate over than standard maps.
@@ -620,15 +694,15 @@ for( animal_map::const_iterator i = map.begin(), e = map.end(); i != e; ++i )
{
std::cout &lt;&lt; &quot;\n key: &quot; &lt;&lt; i-&gt;first;
std::cout &lt;&lt; &quot;\n age: &quot;;
if( boost::is_null(i) )
std::cout &lt;&lt; &quot;unknown&quot;;
else
std::cout &lt;&lt; i-&gt;second-&gt;age();
std::cout &lt;&lt; i-&gt;second-&gt;age();
}
</pre>
<p>Except for the check for null, this looks like it would with a normal map. But if <tt class="docutils literal"><span class="pre">age()</span></tt> had
not been a <tt class="docutils literal"><span class="pre">const</span></tt> member function,
<p>Except for the check for null, this looks like it would with a normal map. But if <tt class="docutils literal">age()</tt> had
not been a <tt class="docutils literal">const</tt> member function,
it would not have compiled.</p>
<p>Maps can also be indexed with bounds-checking</p>
<pre class="literal-block">
@@ -639,29 +713,37 @@ try
catch( boost::bad_ptr_container_operation&amp; e )
{
// &quot;bobo&quot; not found
}
}
</pre>
</div>
<div class="section">
<h1><a id="std-auto-ptr-u-overloads" name="std-auto-ptr-u-overloads"><tt class="docutils literal"><span class="pre">std::auto_ptr&lt;U&gt;</span></tt> overloads</a></h1>
<p>Every time there is a function that takes a <tt class="docutils literal"><span class="pre">T*</span></tt> parameter, there is
also a function taking an <tt class="docutils literal"><span class="pre">std::auto_ptr&lt;U&gt;</span></tt> parameter. This is of course done
to make the library intregrate seamlessly with <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>. For example</p>
<div class="section" id="compatible-smart-pointer-overloads">
<h1>Compatible smart pointer overloads</h1>
<p>Every time there is a function that takes a <tt class="docutils literal">T*</tt> parameter, there is
also a function overload (or two) taking a <tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a>&lt;U&gt;</span></tt>
parameter. This is of course done to make the library intregrate
seamlessly with <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> or <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt>. For example,
consider a statement like</p>
<pre class="literal-block">
std::ptr_vector&lt;Base&gt; vec;
vec.push_back( new Base );
</pre>
<p>is complemented by</p>
<p>If the compiler supports <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt>, this is complemented
by</p>
<pre class="literal-block">
std::auto_ptr&lt;Derived&gt; p( new Derived );
vec.push_back( p );
vec.push_back( p );
</pre>
<p>Notice that the template argument for <tt class="docutils literal"><span class="pre">std::auto_ptr</span></tt> does not need to
follow the template argument for <tt class="docutils literal"><span class="pre">ptr_vector</span></tt> as long as <tt class="docutils literal"><span class="pre">Derived*</span></tt>
can be implicitly converted to <tt class="docutils literal"><span class="pre">Base*</span></tt>.</p>
<p>Similarly if <tt class="docutils literal"><span class="pre">std::unique_ptr</span></tt> is available, we can write</p>
<pre class="literal-block">
std::unique_ptr&lt;Derived&gt; p( new Derived );
vec.push_back( std::move( p ) );
</pre>
<p>Notice that the template argument for <tt class="docutils literal"><span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a></span></tt> does not need to
follow the template argument for <tt class="docutils literal">ptr_vector</tt> as long as <tt class="docutils literal">Derived*</tt>
can be implicitly converted to <tt class="docutils literal">Base*</tt>.</p>
</div>
<div class="section">
<h1><a id="algorithms" name="algorithms">Algorithms</a></h1>
<div class="section" id="algorithms">
<h1>Algorithms</h1>
<p>Unfortunately it is not possible to use pointer containers with
mutating algorithms from the standard library. However,
the most useful ones
@@ -673,13 +755,13 @@ zoo.sort(); // assume 'bool operator&lt;( const an
zoo.sort( std::less&lt;animal&gt;() ); // the same, notice no '*' is present
zoo.sort( zoo.begin(), zoo.begin() + 5 ); // sort selected range
</pre>
<p>Notice that predicates are automatically wrapped in an <a class="reference" href="indirect_fun.html">indirect_fun</a> object.</p>
<p>You can remove equal and adjacent elements using <tt class="docutils literal"><span class="pre">unique()</span></tt>:</p>
<p>Notice that predicates are automatically wrapped in an <a class="reference external" href="indirect_fun.html">indirect_fun</a> object.</p>
<p>You can remove equal and adjacent elements using <tt class="docutils literal">unique()</tt>:</p>
<pre class="literal-block">
zoo.unique(); // assume 'bool operator==( const animal&amp;, const animal&amp; )'
zoo.unique( zoo.begin(), zoo.begin() + 5, my_comparison_predicate() );
zoo.unique( zoo.begin(), zoo.begin() + 5, my_comparison_predicate() );
</pre>
<p>If you just want to remove certain elements, use <tt class="docutils literal"><span class="pre">erase_if</span></tt>:</p>
<p>If you just want to remove certain elements, use <tt class="docutils literal">erase_if</tt>:</p>
<pre class="literal-block">
zoo.erase_if( my_predicate() );
</pre>
@@ -688,24 +770,24 @@ zoo.erase_if( my_predicate() );
boost::ptr_vector&lt;animal&gt; another_zoo = ...;
another_zoo.sort(); // sorted wrt. to same order as 'zoo'
zoo.merge( another_zoo );
BOOST_ASSERT( another_zoo.empty() );
BOOST_ASSERT( another_zoo.empty() );
</pre>
<p>That is all; now you have learned all the basics!</p>
<hr><p><strong>See also</strong></p>
<ul class="simple">
<li><a class="reference" href="guidelines.html">Usage guidelines</a></li>
<li><a class="reference" href="../../conversion/cast.htm#Polymorphic_castl">Cast utilities</a></li>
<li><a class="reference external" href="guidelines.html">Usage guidelines</a></li>
<li><a class="reference external" href="../../conversion/cast.htm#Polymorphic_castl">Cast utilities</a></li>
</ul>
<p><strong>Navigate</strong></p>
<ul class="simple">
<li><a class="reference" href="ptr_container.html">home</a></li>
<li><a class="reference" href="examples.html">examples</a></li>
<li><a class="reference external" href="ptr_container.html">home</a></li>
<li><a class="reference external" href="examples.html">examples</a></li>
</ul>
<hr><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td>
</tr>
</tbody>
</table>

View File

@@ -21,7 +21,7 @@ that you read it all from top to bottom.
* `Null values`_
* `Cloneability`_
* `New functions`_
* `std::auto_ptr<U> overloads`_
* `Compatible smart pointer overloads`_
* `Algorithms`_
Basic usage
@@ -317,7 +317,7 @@ shrinks. For containers that store nulls, we can exploit that
You can also release the entire container if you
want to return it from a function ::
std::auto_ptr< boost::ptr_deque<animal> > get_zoo()
compatible-smart-ptr< boost::ptr_deque<animal> > get_zoo()
{
boost::ptr_deque<animal> result;
...
@@ -375,22 +375,30 @@ Maps can also be indexed with bounds-checking ::
// "bobo" not found
}
``std::auto_ptr<U>`` overloads
------------------------------
Compatible smart pointer overloads
----------------------------------
Every time there is a function that takes a ``T*`` parameter, there is
also a function taking an ``std::auto_ptr<U>`` parameter. This is of course done
to make the library intregrate seamlessly with ``std::auto_ptr``. For example ::
also a function overload (or two) taking a ``compatible-smart-ptr<U>``
parameter. This is of course done to make the library intregrate
seamlessly with ``std::auto_ptr`` or ``std::unique_ptr``. For example,
consider a statement like ::
std::ptr_vector<Base> vec;
vec.push_back( new Base );
is complemented by ::
If the compiler supports ``std::auto_ptr``, this is complemented
by ::
std::auto_ptr<Derived> p( new Derived );
vec.push_back( p );
vec.push_back( p );
Notice that the template argument for ``std::auto_ptr`` does not need to
Similarly if ``std::unique_ptr`` is available, we can write ::
std::unique_ptr<Derived> p( new Derived );
vec.push_back( std::move( p ) );
Notice that the template argument for ``compatible-smart-ptr`` does not need to
follow the template argument for ``ptr_vector`` as long as ``Derived*``
can be implicitly converted to ``Base*``.

View File

@@ -149,6 +149,12 @@
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>ptr_deque</span><span class=special>&lt;</span><span class=identifier>animal</span><span class=special>&gt;</span> <span class=identifier>barn_type</span><span class=special>;</span>
<span class=identifier>barn_type</span> <span class=identifier>barn</span><span class=special>;</span>
<span class=comment>//
// A convenience typedef for the compiler-appropriate
// smart pointer used to manage barns
//</span>
<span class=keyword>typedef</span> <span class=identifier><a href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a></span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>raii_ptr</span><span class=special>;</span>
<span class=comment>//
// An error type
//</span>
@@ -251,8 +257,9 @@
<span class=comment>//
// If things are bad, we might choose to sell all animals :-(
//</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>auto_ptr</span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>sell_farm</span><span class=special>()</span>
//</span>
<span class=identifier>raii_ptr</span> <span class=identifier>sell_farm</span><span class=special>()</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>barn</span><span class=special>.</span><span class=identifier>release</span><span class=special>();</span>
<span class=special>}</span>
@@ -262,7 +269,7 @@
// else's farm :-)
//</span>
<span class=keyword>void</span> <span class=identifier>buy_farm</span><span class=special>(</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>auto_ptr</span><span class=special>&lt;</span><span class=identifier>barn_type</span><span class=special>&gt;</span> <span class=identifier>other</span> <span class=special>)</span>
<span class=keyword>void</span> <span class=identifier>buy_farm</span><span class=special>(</span> <span class=identifier>raii_ptr</span> <span class=identifier>other</span> <span class=special>)</span>
<span class=special>{</span>
<span class=comment>//
// This line inserts all the animals from 'other'