]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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.10: http://docutils.sourceforge.net/" /> | |
7 | <title>Boost Pointer Container Library</title> | |
8 | <style type="text/css"> | |
9 | ||
10 | /* | |
11 | :Author: David Goodger | |
12 | :Contact: goodger@users.sourceforge.net | |
13 | :Date: $Date$ | |
14 | :Revision: $Revision$ | |
15 | :Copyright: This stylesheet has been placed in the public domain. | |
16 | ||
17 | Default cascading style sheet for the HTML output of Docutils. | |
18 | ||
19 | See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to | |
20 | customize this style sheet. | |
21 | */ | |
22 | ||
23 | /* "! important" is used here to override other ``margin-top`` and | |
24 | ``margin-bottom`` styles that are later in the stylesheet or | |
25 | more specific. See http://www.w3.org/TR/CSS1#the-cascade */ | |
26 | .first { | |
27 | margin-top: 0 ! important } | |
28 | ||
29 | .last, .with-subtitle { | |
30 | margin-bottom: 0 ! important } | |
31 | ||
32 | .hidden { | |
33 | display: none } | |
34 | ||
35 | a.toc-backref { | |
36 | text-decoration: none ; | |
37 | color: black } | |
38 | ||
39 | blockquote.epigraph { | |
40 | margin: 2em 5em ; } | |
41 | ||
42 | dl.docutils dd { | |
43 | margin-bottom: 0.5em } | |
44 | ||
45 | /* Uncomment (and remove this text!) to get bold-faced definition list terms | |
46 | dl.docutils dt { | |
47 | font-weight: bold } | |
48 | */ | |
49 | ||
50 | div.abstract { | |
51 | margin: 2em 5em } | |
52 | ||
53 | div.abstract p.topic-title { | |
54 | font-weight: bold ; | |
55 | text-align: center } | |
56 | ||
57 | div.admonition, div.attention, div.caution, div.danger, div.error, | |
58 | div.hint, div.important, div.note, div.tip, div.warning { | |
59 | margin: 2em ; | |
60 | border: medium outset ; | |
61 | padding: 1em } | |
62 | ||
63 | div.admonition p.admonition-title, div.hint p.admonition-title, | |
64 | div.important p.admonition-title, div.note p.admonition-title, | |
65 | div.tip p.admonition-title { | |
66 | font-weight: bold ; | |
67 | font-family: sans-serif } | |
68 | ||
69 | div.attention p.admonition-title, div.caution p.admonition-title, | |
70 | div.danger p.admonition-title, div.error p.admonition-title, | |
71 | div.warning p.admonition-title { | |
72 | color: red ; | |
73 | font-weight: bold ; | |
74 | font-family: sans-serif } | |
75 | ||
76 | /* Uncomment (and remove this text!) to get reduced vertical space in | |
77 | compound paragraphs. | |
78 | div.compound .compound-first, div.compound .compound-middle { | |
79 | margin-bottom: 0.5em } | |
80 | ||
81 | div.compound .compound-last, div.compound .compound-middle { | |
82 | margin-top: 0.5em } | |
83 | */ | |
84 | ||
85 | div.dedication { | |
86 | margin: 2em 5em ; | |
87 | text-align: center ; | |
88 | font-style: italic } | |
89 | ||
90 | div.dedication p.topic-title { | |
91 | font-weight: bold ; | |
92 | font-style: normal } | |
93 | ||
94 | div.figure { | |
95 | margin-left: 2em } | |
96 | ||
97 | div.footer, div.header { | |
98 | clear: both; | |
99 | font-size: smaller } | |
100 | ||
101 | div.line-block { | |
102 | display: block ; | |
103 | margin-top: 1em ; | |
104 | margin-bottom: 1em } | |
105 | ||
106 | div.line-block div.line-block { | |
107 | margin-top: 0 ; | |
108 | margin-bottom: 0 ; | |
109 | margin-left: 1.5em } | |
110 | ||
111 | div.sidebar { | |
112 | margin-left: 1em ; | |
113 | border: medium outset ; | |
114 | padding: 1em ; | |
115 | background-color: #ffffee ; | |
116 | width: 40% ; | |
117 | float: right ; | |
118 | clear: right } | |
119 | ||
120 | div.sidebar p.rubric { | |
121 | font-family: sans-serif ; | |
122 | font-size: medium } | |
123 | ||
124 | div.system-messages { | |
125 | margin: 5em } | |
126 | ||
127 | div.system-messages h1 { | |
128 | color: red } | |
129 | ||
130 | div.system-message { | |
131 | border: medium outset ; | |
132 | padding: 1em } | |
133 | ||
134 | div.system-message p.system-message-title { | |
135 | color: red ; | |
136 | font-weight: bold } | |
137 | ||
138 | div.topic { | |
139 | margin: 2em } | |
140 | ||
141 | h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, | |
142 | h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { | |
143 | margin-top: 0.4em } | |
144 | ||
145 | h1.title { | |
146 | text-align: center } | |
147 | ||
148 | h2.subtitle { | |
149 | text-align: center } | |
150 | ||
151 | hr.docutils { | |
152 | width: 75% } | |
153 | ||
154 | img.align-left { | |
155 | clear: left } | |
156 | ||
157 | img.align-right { | |
158 | clear: right } | |
159 | ||
160 | img.borderless { | |
161 | border: 0 } | |
162 | ||
163 | ol.simple, ul.simple { | |
164 | margin-bottom: 1em } | |
165 | ||
166 | ol.arabic { | |
167 | list-style: decimal } | |
168 | ||
169 | ol.loweralpha { | |
170 | list-style: lower-alpha } | |
171 | ||
172 | ol.upperalpha { | |
173 | list-style: upper-alpha } | |
174 | ||
175 | ol.lowerroman { | |
176 | list-style: lower-roman } | |
177 | ||
178 | ol.upperroman { | |
179 | list-style: upper-roman } | |
180 | ||
181 | p.attribution { | |
182 | text-align: right ; | |
183 | margin-left: 50% } | |
184 | ||
185 | p.caption { | |
186 | font-style: italic } | |
187 | ||
188 | p.credits { | |
189 | font-style: italic ; | |
190 | font-size: smaller } | |
191 | ||
192 | p.label { | |
193 | white-space: nowrap } | |
194 | ||
195 | p.rubric { | |
196 | font-weight: bold ; | |
197 | font-size: larger ; | |
198 | color: maroon ; | |
199 | text-align: center } | |
200 | ||
201 | p.sidebar-title { | |
202 | font-family: sans-serif ; | |
203 | font-weight: bold ; | |
204 | font-size: larger } | |
205 | ||
206 | p.sidebar-subtitle { | |
207 | font-family: sans-serif ; | |
208 | font-weight: bold } | |
209 | ||
210 | p.topic-title { | |
211 | font-weight: bold } | |
212 | ||
213 | pre.address { | |
214 | margin-bottom: 0 ; | |
215 | margin-top: 0 ; | |
216 | font-family: serif ; | |
217 | font-size: 100% } | |
218 | ||
219 | pre.line-block { | |
220 | font-family: serif ; | |
221 | font-size: 100% } | |
222 | ||
223 | pre.literal-block, pre.doctest-block { | |
224 | margin-left: 2em ; | |
225 | margin-right: 2em ; | |
226 | background-color: #eeeeee } | |
227 | ||
228 | span.classifier { | |
229 | font-family: sans-serif ; | |
230 | font-style: oblique } | |
231 | ||
232 | span.classifier-delimiter { | |
233 | font-family: sans-serif ; | |
234 | font-weight: bold } | |
235 | ||
236 | span.interpreted { | |
237 | font-family: sans-serif } | |
238 | ||
239 | span.option { | |
240 | white-space: nowrap } | |
241 | ||
242 | span.pre { | |
243 | white-space: pre } | |
244 | ||
245 | span.problematic { | |
246 | color: red } | |
247 | ||
248 | span.section-subtitle { | |
249 | /* font-size relative to parent (h1..h6 element) */ | |
250 | font-size: 80% } | |
251 | ||
252 | table.citation { | |
253 | border-left: solid thin gray } | |
254 | ||
255 | table.docinfo { | |
256 | margin: 2em 4em } | |
257 | ||
258 | table.docutils { | |
259 | margin-top: 0.5em ; | |
260 | margin-bottom: 0.5em } | |
261 | ||
262 | table.footnote { | |
263 | border-left: solid thin black } | |
264 | ||
265 | table.docutils td, table.docutils th, | |
266 | table.docinfo td, table.docinfo th { | |
267 | padding-left: 0.5em ; | |
268 | padding-right: 0.5em ; | |
269 | vertical-align: top } | |
270 | ||
271 | table.docutils th.field-name, table.docinfo th.docinfo-name { | |
272 | font-weight: bold ; | |
273 | text-align: left ; | |
274 | white-space: nowrap ; | |
275 | padding-left: 0 } | |
276 | ||
277 | h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, | |
278 | h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { | |
279 | font-size: 100% } | |
280 | ||
281 | tt.docutils { | |
282 | background-color: #eeeeee } | |
283 | ||
284 | ul.auto-toc { | |
285 | list-style-type: none } | |
286 | ||
287 | </style> | |
288 | </head> | |
289 | <body> | |
290 | <div class="document" id="boost-pointer-container-library"> | |
291 | <h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1> | |
292 | <div class="section"> | |
293 | <h1><a id="class-ptr-array" name="class-ptr-array">Class <tt class="docutils literal"><span class="pre">ptr_array</span></tt></a></h1> | |
294 | <p>A <tt class="docutils literal"><span class="pre">ptr_array<T,size></span></tt> is a pointer container that uses an underlying <tt class="docutils literal"><span class="pre">boost::array<void*,size></span></tt> | |
295 | to store the pointers. The class is useful when there is no requirement | |
296 | of dynamic expansion and when no overhead is tolerable.</p> | |
297 | <p><strong>Hierarchy:</strong></p> | |
298 | <ul class="simple"> | |
299 | <li><a class="reference" href="reversible_ptr_container.html">reversible_ptr_container</a><ul> | |
300 | <li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul> | |
301 | <li><a class="reference" href="ptr_vector.html">ptr_vector</a></li> | |
302 | <li><a class="reference" href="ptr_list.html">ptr_list</a></li> | |
303 | <li><a class="reference" href="ptr_deque.html">ptr_deque</a></li> | |
304 | <li><tt class="docutils literal"><span class="pre">ptr_array</span></tt></li> | |
305 | </ul> | |
306 | </li> | |
307 | </ul> | |
308 | </li> | |
309 | </ul> | |
310 | <p><strong>Navigate:</strong></p> | |
311 | <ul class="simple"> | |
312 | <li><a class="reference" href="ptr_container.html">home</a></li> | |
313 | <li><a class="reference" href="reference.html">reference</a></li> | |
314 | </ul> | |
315 | <p><strong>Synopsis:</strong></p> | |
316 | <pre class="literal-block"> | |
317 | namespace boost | |
318 | { | |
319 | ||
320 | template | |
321 | < | |
322 | class T, | |
323 | size_t N, | |
324 | CloneAllocator = heap_clone_allocator | |
325 | > | |
326 | class ptr_array : public <em>implementation-defined</em> | |
327 | { | |
328 | public: // <a class="reference" href="#construct-copy-destroy">construct/copy/destroy</a> | |
329 | ptr_array(); | |
330 | explicit ptr_array( const ptr_array& r ); | |
331 | template< class U > | |
332 | explicit ptr_array( const ptr_array<U,N>& r ); | |
333 | explicit ptr_array( std::auto_ptr<ptr_array>& r ); | |
334 | ||
335 | ptr_array& operator=( const ptr_array& r ); | |
336 | template< class U > | |
337 | ptr_array& operator=( const ptr_array<U,N>& r ); | |
338 | ptr_array& operator=( std::auto_ptr<this_type> r ); | |
339 | ||
340 | public: // <a class="reference" href="reversible_ptr_container.html#iterators">iterators</a> | |
341 | ||
342 | public: // <a class="reference" href="reversible_ptr_container.html#capacity">capacity</a> | |
343 | ||
344 | public: // <a class="reference" href="#element-access">element access</a> | |
345 | T& front(); | |
346 | const T& front() const; | |
347 | T& back(); | |
348 | const T& back() const; | |
349 | ||
350 | template< size_t idx > | |
351 | T& at(); | |
352 | template< size_t idx > | |
353 | const T& at() const; | |
354 | T& at( size_t ); | |
355 | const T& at( size_t ); | |
356 | ||
357 | T& operator[]( size_t ); | |
358 | const T& operator[]( size_t ) const; | |
359 | ||
360 | public: // <a class="reference" href="#modifiers">modifiers</a> | |
361 | void swap( ptr_array& r ); | |
362 | ||
363 | template< size_t idx > | |
364 | auto_type replace( T* r ); | |
365 | template< size_t idx, class U > | |
366 | auto_type replace( std::auto_ptr<U> r ); | |
367 | auto_type replace( size_t idx, T* r ); | |
368 | template< class U > | |
369 | auto_type replace( size_t idx, std::auto_ptr<U> r ); | |
370 | ||
371 | public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a> | |
372 | std::auto_ptr<ptr_array> clone() const; | |
373 | std::auto_ptr<ptr_array> release(); | |
374 | template< size_t idx > | |
375 | bool is_null() const; | |
376 | bool is_null( size_t idx ) const; | |
377 | ||
378 | }; // class 'ptr_sequence_adapter' | |
379 | ||
380 | } // namespace 'boost' | |
381 | </pre> | |
382 | </div> | |
383 | <div class="section"> | |
384 | <h1><a id="semantics" name="semantics">Semantics</a></h1> | |
385 | <div class="section"> | |
386 | <h2><a id="semantics-construct-copy-destroy" name="semantics-construct-copy-destroy"><span id="construct-copy-destroy"></span>Semantics: construct/copy/destroy</a></h2> | |
387 | <ul> | |
388 | <li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array();</span></tt></p> | |
389 | <blockquote> | |
390 | <ul class="simple"> | |
391 | <li>Effects: constructs array where each element is null</li> | |
392 | </ul> | |
393 | </blockquote> | |
394 | </li> | |
395 | <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&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
396 | </li> | |
397 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">></span> | |
398 | <span class="pre">explicit</span> <span class="pre">ptr_array(</span> <span class="pre">const</span> <span class="pre">ptr_array<U,N>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
399 | <ul class="simple"> | |
400 | <li>Effects: Constructs array by cloning <tt class="docutils literal"><span class="pre">r</span></tt></li> | |
401 | </ul> | |
402 | </li> | |
403 | <li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array(</span> <span class="pre">std::auto_ptr<ptr_array>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
404 | <blockquote> | |
405 | <ul class="simple"> | |
406 | <li>Effects: take ownership of the supplied pointers</li> | |
407 | </ul> | |
408 | </blockquote> | |
409 | </li> | |
410 | <li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array&</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">ptr_array&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
411 | </li> | |
412 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">></span> <span class="pre">ptr_array&</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">ptr_array<U,N>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
413 | <blockquote> | |
414 | <ul class="simple"> | |
415 | <li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li> | |
416 | <li>Exception safety: Strong guarantee</li> | |
417 | </ul> | |
418 | </blockquote> | |
419 | </li> | |
420 | <li><p class="first"><tt class="docutils literal"><span class="pre">ptr_array&</span> <span class="pre">operator=(</span> <span class="pre">std::auto_ptr<this_type></span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
421 | <blockquote> | |
422 | <ul class="simple"> | |
423 | <li>Effects: take ownership of the supplied pointers</li> | |
424 | <li>Throws: Nothing</li> | |
425 | </ul> | |
426 | </blockquote> | |
427 | </li> | |
428 | </ul> | |
429 | </div> | |
430 | <div class="section"> | |
431 | <h2><a id="semantics-element-access" name="semantics-element-access"><span id="element-access"></span>Semantics: element access</a></h2> | |
432 | <ul> | |
433 | <li><p class="first"><tt class="docutils literal"><span class="pre">T&</span> <span class="pre">front();</span></tt></p> | |
434 | </li> | |
435 | <li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</span> <span class="pre">front()</span> <span class="pre">const;</span></tt></p> | |
436 | <blockquote> | |
437 | <ul class="simple"> | |
438 | <li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li> | |
439 | <li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*begin();</span></tt></li> | |
440 | <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> | |
441 | </ul> | |
442 | </blockquote> | |
443 | </li> | |
444 | <li><p class="first"><tt class="docutils literal"><span class="pre">T&</span> <span class="pre">back();</span></tt></p> | |
445 | </li> | |
446 | <li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</span> <span class="pre">back()</span> <span class="pre">const;</span></tt></p> | |
447 | <blockquote> | |
448 | <ul class="simple"> | |
449 | <li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li> | |
450 | <li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">*--end();</span></tt></li> | |
451 | <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> | |
452 | </ul> | |
453 | </blockquote> | |
454 | </li> | |
455 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">></span> <span class="pre">T&</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p> | |
456 | </li> | |
457 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">></span> <span class="pre">const</span> <span class="pre">T&</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> | |
458 | <blockquote> | |
459 | <ul class="simple"> | |
460 | <li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre"><</span> <span class="pre">size()</span></tt> (compile-time enforced)</li> | |
461 | <li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li> | |
462 | <li>Throws: nothing</li> | |
463 | </ul> | |
464 | </blockquote> | |
465 | </li> | |
466 | <li><p class="first"><tt class="docutils literal"><span class="pre">T&</span> <span class="pre">at(</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p> | |
467 | </li> | |
468 | <li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</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> | |
469 | <blockquote> | |
470 | <ul class="simple"> | |
471 | <li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre"><</span> <span class="pre">size()</span></tt></li> | |
472 | <li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li> | |
473 | <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">>=size()</span></tt></li> | |
474 | </ul> | |
475 | </blockquote> | |
476 | </li> | |
477 | <li><p class="first"><tt class="docutils literal"><span class="pre">T&</span> <span class="pre">operator[](</span> <span class="pre">size_type</span> <span class="pre">n</span> <span class="pre">);</span></tt></p> | |
478 | </li> | |
479 | <li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">T&</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> | |
480 | <blockquote> | |
481 | <ul class="simple"> | |
482 | <li>Requirements: <tt class="docutils literal"><span class="pre">n</span> <span class="pre"><</span> <span class="pre">size()</span></tt></li> | |
483 | <li>Effects: Returns a reference to the <tt class="docutils literal"><span class="pre">n</span></tt>'th element</li> | |
484 | <li>Throws: Nothing</li> | |
485 | </ul> | |
486 | </blockquote> | |
487 | </li> | |
488 | </ul> | |
489 | </div> | |
490 | <div class="section"> | |
491 | <h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2> | |
492 | <ul> | |
493 | <li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">swap(</span> <span class="pre">ptr_array&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
494 | <blockquote> | |
495 | <ul class="simple"> | |
496 | <li>Effects: swaps the two arrays</li> | |
497 | <li>Complexity: Linear</li> | |
498 | <li>Throws: nothing</li> | |
499 | </ul> | |
500 | </blockquote> | |
501 | </li> | |
502 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">></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> | |
503 | <blockquote> | |
504 | <ul> | |
505 | <li><p class="first">Requirements:</p> | |
506 | <blockquote> | |
507 | <ul class="simple"> | |
508 | <li><tt class="docutils literal"><span class="pre">idx</span> <span class="pre"><</span> <span class="pre">size()</span></tt> (compile-time enforced)</li> | |
509 | <li><tt class="docutils literal"><span class="pre">r</span> <span class="pre">!=</span> <span class="pre">0</span></tt></li> | |
510 | </ul> | |
511 | </blockquote> | |
512 | </li> | |
513 | <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> | |
514 | </li> | |
515 | <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> | |
516 | </li> | |
517 | <li><p class="first">Exception safety: Strong guarantee</p> | |
518 | </li> | |
519 | </ul> | |
520 | </blockquote> | |
521 | </li> | |
522 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</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">></span> <span class="pre">auto_type</span> <span class="pre">replace(</span> <span class="pre">std::auto_ptr<U></span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
523 | <blockquote> | |
524 | <ul class="simple"> | |
525 | <li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">replace<idx>(</span> <span class="pre">r.release()</span> <span class="pre">);</span></tt></li> | |
526 | </ul> | |
527 | </blockquote> | |
528 | </li> | |
529 | <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> | |
530 | <blockquote> | |
531 | <ul class="simple"> | |
532 | <li>Requirements: `` x != 0 and idx < size()``</li> | |
533 | <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> | |
534 | <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">>=</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> | |
535 | <li>Exception safety: Strong guarantee</li> | |
536 | </ul> | |
537 | </blockquote> | |
538 | </li> | |
539 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">U</span> <span class="pre">></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<U></span> <span class="pre">r</span> <span class="pre">);</span></tt></p> | |
540 | <blockquote> | |
541 | <ul class="simple"> | |
542 | <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> | |
543 | </ul> | |
544 | </blockquote> | |
545 | </li> | |
546 | </ul> | |
547 | </div> | |
548 | <div class="section"> | |
549 | <h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2> | |
550 | <ul> | |
551 | <li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr<ptr_array></span> <span class="pre">clone()</span> <span class="pre">const;</span></tt></p> | |
552 | <blockquote> | |
553 | <ul class="simple"> | |
554 | <li>Effects: Returns a deep copy of the container</li> | |
555 | <li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if there is not enough memory to make a clone of the container</li> | |
556 | <li>Complexity: Linear</li> | |
557 | </ul> | |
558 | </blockquote> | |
559 | </li> | |
560 | <li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr<ptr_array></span> <span class="pre">release();</span></tt></p> | |
561 | <blockquote> | |
562 | <ul class="simple"> | |
563 | <li>Effects: Releases ownership of the container. This is a useful way of returning a container from a function.</li> | |
564 | <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> | |
565 | <li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if the return value cannot be allocated</li> | |
566 | <li>Exception safety: Strong guarantee</li> | |
567 | </ul> | |
568 | </blockquote> | |
569 | </li> | |
570 | <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">size_t</span> <span class="pre">idx</span> <span class="pre">></span> <span class="pre">bool</span> <span class="pre">is_null()</span> <span class="pre">const;</span></tt></p> | |
571 | <blockquote> | |
572 | <ul class="simple"> | |
573 | <li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre"><</span> <span class="pre">size()</span></tt> (compile-time enforced)</li> | |
574 | <li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li> | |
575 | <li>Exception safety: Nothrow guarantee</li> | |
576 | </ul> | |
577 | </blockquote> | |
578 | </li> | |
579 | <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> | |
580 | <blockquote> | |
581 | <ul class="simple"> | |
582 | <li>Requirements: <tt class="docutils literal"><span class="pre">idx</span> <span class="pre"><</span> <span class="pre">size()</span></tt></li> | |
583 | <li>Effects: returns whether the pointer at index <tt class="docutils literal"><span class="pre">idx</span></tt> is null</li> | |
584 | <li>Exception safety: Nothrow guarantee</li> | |
585 | </ul> | |
586 | </blockquote> | |
587 | </li> | |
588 | </ul> | |
589 | <hr><table class="docutils field-list" frame="void" rules="none"> | |
590 | <col class="field-name" /> | |
591 | <col class="field-body" /> | |
592 | <tbody valign="top"> | |
593 | <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> | |
594 | </tr> | |
595 | </tbody> | |
596 | </table> | |
597 | </div> | |
598 | </div> | |
599 | </div> | |
600 | </body> | |
601 | </html> |