Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/ptr_container/doc/ptr_deque.html @ 14

Last change on this file since 14 was 12, checked in by landauf, 17 years ago

added boost

File size: 8.6 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
7<title>Boost Pointer Container Library</title>
8<link rel="stylesheet" href="default.css" type="text/css" />
9</head>
10<body>
11<div class="document" id="boost-pointer-container-library">
12<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1>
13<div class="section" id="class-ptr-deque">
14<h1><a name="class-ptr-deque">Class <tt class="docutils literal"><span class="pre">ptr_deque</span></tt></a></h1>
15<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>
16to store the pointers.</p>
17<p><strong>See also:</strong></p>
18<ul class="simple">
19<li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a></li>
20<li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a></li>
21</ul>
22<p><strong>Navigate:</strong></p>
23<ul class="simple">
24<li><a class="reference" href="ptr_container.html">home</a></li>
25<li><a class="reference" href="reference.html">reference</a></li>
26</ul>
27<p><strong>Synopsis:</strong></p>
28<pre class="literal-block">
29namespace boost
30{     
31
32    template
33    &lt; 
34        class T,
35        class CloneAllocator = heap_clone_allocator
36        class Allocator      = std::allocator&lt;void*&gt;
37    &gt;
38    class ptr_deque : public ptr_sequence_adapter
39                             &lt;
40                                T,
41                                std::deque&lt;void*,Allocator&gt;,
42                                CloneAllocator
43                             &gt;
44    {
45
46    public: // <a class="reference" href="#element-access">element access</a>
47        T&amp;        operator[]( size_type n );
48        const T&amp;  operator[]( size_type n ) const;
49        T&amp;        at( size_type n );
50        const T&amp;  at( size_type n ) const;
51
52    public: // <a class="reference" href="#modifiers">modifiers</a>
53        void      push_front( T* x );
54        auto_type pop_front();
55
56    public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
57       auto_type replace( size_type idx, T* x );   
58       bool      is_null( size_type idx ) const;   
59
60    };
61
62} // namespace 'boost' 
63</pre>
64</div>
65<div class="section" id="semantics">
66<h1><a name="semantics">Semantics</a></h1>
67<span id="modifiers"></span><div class="section" id="semantics-modifiers">
68<h2><a name="semantics-modifiers">Semantics: modifiers</a></h2>
69<ul>
70<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>
71<blockquote>
72<ul class="simple">
73<li>Requirements: <tt class="docutils literal"><span class="pre">x</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li>
74<li>Effects: Inserts the pointer into container and takes ownership of it</li>
75<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>
76<li>Exception safety: Strong guarantee</li>
77</ul>
78</blockquote>
79</li>
80</ul>
81<!-- - ``void push_front( const T& x );``
82
83- Effects: push_front( allocate_clone( x ) );
84
85- Exception safety: Strong guarantee -->
86<ul>
87<li><p class="first"><tt class="docutils literal"><span class="pre">auto_type</span> <span class="pre">pop_front():</span></tt></p>
88<blockquote>
89<ul class="simple">
90<li>Requirements:<tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty()</span></tt></li>
91<li>Effects: Removes the first element in the container</li>
92<li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
93<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>
94<li>Exception safety: Strong guarantee</li>
95</ul>
96</blockquote>
97</li>
98</ul>
99</div>
100<span id="element-access"></span><div class="section" id="semantics-element-access">
101<h2><a name="semantics-element-access">Semantics: element access</a></h2>
102<ul>
103<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>
104</li>
105<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>
106<blockquote>
107<ul class="simple">
108<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
109<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
110<li>Throws: Nothing</li>
111</ul>
112</blockquote>
113</li>
114<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>
115</li>
116<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>
117<blockquote>
118<ul class="simple">
119<li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
120<li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li>
121<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>
122</ul>
123</blockquote>
124</li>
125</ul>
126</div>
127<span id="pointer-container-requirements"></span><div class="section" id="semantics-pointer-container-requirements">
128<h2><a name="semantics-pointer-container-requirements">Semantics: pointer container requirements</a></h2>
129<ul>
130<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>
131<blockquote>
132<ul class="simple">
133<li>Requirements: `` x != 0 and idx &lt; size()``</li>
134<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>
135<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>
136<li>Exception safety: Strong guarantee</li>
137</ul>
138</blockquote>
139</li>
140<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>
141<blockquote>
142<ul class="simple">
143<li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre">&lt;</span> <span class="pre">size()</span></tt></li>
144<li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li>
145<li>Exception safety: Nothrow guarantee</li>
146</ul>
147</blockquote>
148</li>
149</ul>
150<table class="docutils field-list" frame="void" rules="none">
151<col class="field-name" />
152<col class="field-body" />
153<tbody valign="top">
154<tr class="field"><th class="field-name">copyright:</th><td class="field-body">Thorsten Ottosen 2004-2005.</td>
155</tr>
156</tbody>
157</table>
158</div>
159</div>
160</div>
161</body>
162</html>
Note: See TracBrowser for help on using the repository browser.