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">
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">
11 :Author: David Goodger
12 :Contact: goodger@users.sourceforge.net
15 :Copyright: This stylesheet has been placed in the public domain.
17 Default cascading style sheet for the HTML output of Docutils.
19 See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
20 customize this style sheet.
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 */
27 margin-top: 0 ! important }
29 .last, .with-subtitle {
30 margin-bottom: 0 ! important }
36 text-decoration: none ;
43 margin-bottom: 0.5em }
45 /* Uncomment (and remove this text!) to get bold-faced definition list terms
53 div.abstract p.topic-title {
57 div.admonition, div.attention, div.caution, div.danger, div.error,
58 div.hint, div.important, div.note, div.tip, div.warning {
60 border: medium outset ;
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 {
67 font-family: sans-serif }
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 {
74 font-family: sans-serif }
76 /* Uncomment (and remove this text!) to get reduced vertical space in
78 div.compound .compound-first, div.compound .compound-middle {
79 margin-bottom: 0.5em }
81 div.compound .compound-last, div.compound .compound-middle {
90 div.dedication p.topic-title {
97 div.footer, div.header {
106 div.line-block div.line-block {
113 border: medium outset ;
115 background-color: #ffffee ;
120 div.sidebar p.rubric {
121 font-family: sans-serif ;
124 div.system-messages {
127 div.system-messages h1 {
131 border: medium outset ;
134 div.system-message p.system-message-title {
141 h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
142 h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
163 ol.simple, ul.simple {
167 list-style: decimal }
170 list-style: lower-alpha }
173 list-style: upper-alpha }
176 list-style: lower-roman }
179 list-style: upper-roman }
193 white-space: nowrap }
202 font-family: sans-serif ;
207 font-family: sans-serif ;
223 pre.literal-block, pre.doctest-block {
226 background-color: #eeeeee }
229 font-family: sans-serif ;
230 font-style: oblique }
232 span.classifier-delimiter {
233 font-family: sans-serif ;
237 font-family: sans-serif }
240 white-space: nowrap }
248 span.section-subtitle {
249 /* font-size relative to parent (h1..h6 element) */
253 border-left: solid thin gray }
260 margin-bottom: 0.5em }
263 border-left: solid thin black }
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 }
271 table.docutils th.field-name, table.docinfo th.docinfo-name {
274 white-space: nowrap ;
277 h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
278 h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
282 background-color: #eeeeee }
285 list-style-type: none }
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-reversible-ptr-container" name="class-reversible-ptr-container">Class <tt class="docutils literal"><span class="pre">reversible_ptr_container</span></tt></a></h1>
294 <p>This class is not a real class that can be found in the library.
295 Its purpose is to present the general interface of all the pointer containers.</p>
296 <p><strong>Hierarchy:</strong></p>
298 <li><tt class="docutils literal"><span class="pre">reversible_ptr_container</span></tt><ul>
299 <li><a class="reference" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul>
300 <li><a class="reference" href="ptr_vector.html">ptr_vector</a></li>
301 <li><a class="reference" href="ptr_list.html">ptr_list</a></li>
302 <li><a class="reference" href="ptr_deque.html">ptr_deque</a></li>
303 <li><a class="reference" href="ptr_array.html">ptr_array</a></li>
306 <li><a class="reference" href="associative_ptr_container.html">associative_ptr_container</a><ul>
307 <li><a class="reference" href="ptr_set_adapter.html">ptr_set_adapter</a></li>
308 <li><a class="reference" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li>
309 <li><a class="reference" href="ptr_map_adapter.html">ptr_map_adapter</a></li>
310 <li><a class="reference" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul>
311 <li><a class="reference" href="ptr_set.html">ptr_set</a></li>
312 <li><a class="reference" href="ptr_multiset.html">ptr_multi_set</a></li>
313 <li><a class="reference" href="ptr_map.html">ptr_map</a></li>
314 <li><a class="reference" href="ptr_multimap.html">ptr_multimap</a></li>
322 <p><strong>Navigate:</strong></p>
324 <li><a class="reference" href="ptr_container.html">home</a></li>
325 <li><a class="reference" href="reference.html">reference</a></li>
327 <p><strong>synopsis:</strong></p>
328 <pre class="literal-block">
334 class CloneAllocator,
335 class VoidPtrContainer
337 class reversible_ptr_container
339 public: // <a class="reference" href="#typedefs">typedefs</a>
340 typedef T* value_type;
341 typedef T& reference;
342 typedef const T& const_reference;
343 typedef <em>implementation defined</em> iterator;
344 typedef <em>implementation defined</em> const_iterator;
345 typedef typename VoidPtrContainer::differnce_type difference_type;
346 typedef typename VoidPtrContainer::size_type size_type;
347 typedef typename VoidPtrContainer::allocator_type allocator_type;
348 typedef <em>implementation defined</em> reverse_iterator;
349 typedef <em>implementation defined</em> const_reverse_iterator;
350 typedef <em>implementation defined</em> auto_type;
352 public: // <a class="reference" href="#construct-copy-destroy">construct/copy/destroy</a>
353 reversible_ptr_container();
354 explicit reversible_ptr_container( const reversible_ptr_container& r );
355 template< class Derived >
356 explicit reversible_ptr_container( const reversible_ptr_container<Derived>& r );
357 explicit reversible_ptr_container( std::auto_ptr<reversible_ptr_container> r );
358 template< class InputIterator >
359 reversible_ptr_container( InputIterator first, InputIterator last );
361 ~reversible_ptr_container();
363 reversible_ptr_container& operator=( const reversible_ptr_container& r );
364 template<class Derived>
365 reversible_ptr_container& operator=( const reversible_ptr_container<Derived>& r );
366 reversible_ptr_container& operator=( std::auto_ptr<reversible_ptr_container> r );
367 allocator_type get_allocator() const;
369 public: // <a class="reference" href="#iterators">iterators</a>
371 const_iterator begin() const;
373 const_iterator end() const;
374 reverse_iterator rbegin();
375 const_reverse_iterator rbegin() const;
376 reverse_iterator rend();
377 const_reverse_iterator rend() const;
379 public: // <a class="reference" href="#capacity">capacity</a>
380 size_type size() const;
381 size_type max_size() const;
384 public: // <a class="reference" href="#modifiers">modifiers</a>
385 void swap( reversible_ptr_container& r );
387 VoidPtrContainer& base();
388 const VoidPtrContainer& base() const;
390 public: // <a class="reference" href="#pointer-container-requirements">pointer container requirements</a>
391 auto_type replace( iterator position, T* x );
392 template< class U >
393 auto_type replace( iterator position, std::auto_ptr<U> x );
394 std::auto_ptr<reversible_ptr_container> clone() const;
395 std::auto_ptr<reversible_ptr_container> release();
396 auto_type release( iterator position );
398 }; // class 'reversible_ptr_container'
400 // <a class="reference" href="#comparison">comparison</a>
401 template < class T, class CA, class VPC >
402 bool operator==( const reversible_ptr_container<T,CA,VPC>& x,
403 const reversible_ptr_container<T,CA,VPC>& y);
405 template < class T, class CA, class VPC >
406 bool operator<( const reversible_ptr_container<T,CA,VPC>& x,
407 const reversible_ptr_container<T,CA,VPC>& y);
409 template < class T, class CA, class VPC >
410 bool operator!=( const reversible_ptr_container<T,CA,VPC>& x,
411 const reversible_ptr_container<T,CA,VPC>& y);
413 template < class T, class CA, class VPC >
414 bool operator>( const reversible_ptr_container<T,CA,VPC>& x,
415 const reversible_ptr_container<T,CA,VPC>& y);
417 template < class T, class CA, class VPC >
418 bool operator>=( const reversible_ptr_container<T,CA,VPC>& x,
419 const reversible_ptr_container<T,CA,VPC>& y);
421 template < class T, class CA, class VPC >
422 bool operator<=( const reversible_ptr_container<T,CA,VPC>& x,
423 const reversible_ptr_container<T,CA,VPC>& y);
425 template< class T, class CA, class VPC >
426 void swap( reversible_ptr_container<T,CA,VPC>& x,
427 reversible_ptr_container<T,CA,VPC>& y );
429 // <a class="reference" href="#cloneability">cloneability</a>
430 template< class T, class CA, class VPC >
431 reversible_ptr_container<T,CA,VPC>*
432 new_clone( const reversible_ptr_container<T,CA,VPC>& r );
434 // <a class="reference" href="#null-predicate">null predicate</a>
435 template< class Iterator >
436 bool is_null( Iterator i );
438 // <a class="reference" href="#serialization">serialization</a>
439 template<class Archive, class T, class CA, class VPC>
440 void serialize( Archive& ar, reversible_ptr_container<T,CÁ,VPC>& c, const unsigned int version );
443 } // namespace 'boost'
446 <div class="section">
447 <h1><a id="semantics" name="semantics">Semantics</a></h1>
448 <div class="section">
449 <h2><a id="semantics-typedefs" name="semantics-typedefs"><span id="typedefs"></span>Semantics: typedefs</a></h2>
450 <p>Notice how these two types differ:</p>
452 <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>
455 <li>notice this has pointer type</li>
459 <li><p class="first"><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">T&</span> <span class="pre">reference;</span></tt></p>
462 <li>notice this is not a pointer type</li>
467 <p>This is done to be able to add pointers directly
468 to the container, but to hide the pointers externally.</p>
469 <!-- - ``typedef *implementation defined* object_type;``
470 - this is ``T`` for sequences and sets
471 - this is ``std::pair<const Key, void*>`` for maps -->
472 <p>Also notice that</p>
474 <li><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">iterator</span></tt></li>
476 <p>allows one to iterate over <tt class="docutils literal"><span class="pre">T&</span></tt> objects, not <tt class="docutils literal"><span class="pre">T*</span></tt>.
478 <pre class="literal-block">
482 <p>returns an iterator that allows one to iterate over <tt class="docutils literal"><span class="pre">void*</span></tt>
483 elements (<em>this is very rarely needed and you should not use the
484 functionality unless you know what you are doing</em>).</p>
486 <li><tt class="docutils literal"><span class="pre">typedef</span> <span class="pre">...</span> <span class="pre">auto_type</span></tt></li>
488 <p>This declaration hides a pointer pointer type. You can rely on the following
490 <pre class="literal-block">
491 T* operator->() const;
492 T& operator*() const;
495 operator <em>implementation-defined bool</em>();
497 <p>The destructor will delete the stored object <em>using the clone allocator of the container</em>
498 (this explains why we cannot use <tt class="docutils literal"><span class="pre">std::auto_ptr<T></span></tt>). It might help to
499 think it is just an <tt class="docutils literal"><span class="pre">std::auto_ptr<T></span></tt>. You can also return
500 the pointer from a function or assign it to another pointer via the <tt class="docutils literal"><span class="pre">move()</span></tt>
502 <pre class="literal-block">
504 auto_type other = boost::ptr_container::move( ptr );
505 return boost::ptr_container::move( other );
508 <div class="section">
509 <h2><a id="semantics-construct-copy-destroy" name="semantics-construct-copy-destroy"><span id="construct-copy-destroy"></span>Semantics: construct/copy/destroy</a></h2>
511 <li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container();</span></tt></p>
514 <li>Effects: Constructs an empty container</li>
515 <li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span> <span class="pre">==</span> <span class="pre">0</span></tt></li>
520 <!-- - ``reversible_ptr_container( size_type n, const T& x );``
522 - Effects: Constructs a container with ``n`` clones of ``x``
524 - Postconditions: ``size() == n`` -->
526 <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&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
529 <li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal"><span class="pre">r</span></tt></li>
533 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">Derived</span> <span class="pre">></span> <span class="pre">explicit</span> <span class="pre">reversible_ptr_container(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container<Derived>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
536 <li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal"><span class="pre">r</span></tt></li>
537 <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>
541 <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<</span> <span class="pre">reversible_ptr_container</span> <span class="pre">></span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
544 <li>Effects: Constructs a container by taking ownership of the supplied pointers</li>
548 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">InputIterator</span> <span class="pre">></span></tt>
549 <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>
552 <li>Requirements: <tt class="docutils literal"><span class="pre">(first,last]</span></tt> is a valid range</li>
553 <li>Effects: Constructs a container with a cloned range of <tt class="docutils literal"><span class="pre">(first,last]</span></tt></li>
554 <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>
558 <li><p class="first"><tt class="docutils literal"><span class="pre">~reversible_ptr_container();</span></tt></p>
561 <li>Effects: Deletes the stored objects via the clone allocator</li>
562 <li>Throws: Nothing</li>
566 <li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container&</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
569 <li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li>
570 <li>Exception safety: strong guarantee</li>
574 <li><p class="first"><tt class="docutils literal"><span class="pre">template<class</span> <span class="pre">Derived></span> <span class="pre">reversible_ptr_container&</span> <span class="pre">operator=(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container<Derived>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
577 <li>Effects: Assigns a clone of <tt class="docutils literal"><span class="pre">r</span></tt></li>
578 <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>
579 <li>Exception safety: Strong guarantee</li>
583 <li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container&</span> <span class="pre">operator=(</span> <span class="pre">std::auto_ptr<reversible_ptr_container></span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
586 <li>Effects: Deletes the stored objects and then takes ownership of the supplied pointers</li>
587 <li>Throws: Nothing</li>
591 <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>
594 <li>Effects: Returns a copy of the allocator of the container object</li>
600 <div class="section">
601 <h2><a id="semantics-iterators" name="semantics-iterators"><span id="iterators"></span>Semantics: iterators</a></h2>
602 <p><strong>See also:</strong> <a class="reference" href="conventions.html#iterators-are-invalidated-as-in-the-corresponding-standard-container">iterator invalidation</a></p>
604 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">begin();</span></tt></p>
606 <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>
609 <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>
610 <li>Throws: Nothing</li>
614 <li><p class="first"><tt class="docutils literal"><span class="pre">iterator</span> <span class="pre">end();</span></tt></p>
616 <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>
619 <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>
620 <li>Throws: Nothing</li>
624 <li><p class="first"><tt class="docutils literal"><span class="pre">reverse_iterator</span> <span class="pre">rbegin();</span></tt></p>
626 <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>
629 <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>
630 <li>Throws: Nothing</li>
634 <li><p class="first"><tt class="docutils literal"><span class="pre">reverse_iterator</span> <span class="pre">rend();</span></tt></p>
636 <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>
639 <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>
640 <li>Throws: Nothing</li>
646 <div class="section">
647 <h2><a id="semantics-capacity" name="semantics-capacity"><span id="capacity"></span>Semantics: capacity</a></h2>
649 <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>
652 <li>Effects: Returns the number of stored elements</li>
653 <li>Throws: Nothing</li>
657 <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>
660 <li>Effects: Returns the maximum number of stored elements</li>
661 <li>Throws: Nothing</li>
665 <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>
668 <li>Effects: Returns whether the container is empty or not</li>
669 <li>Throws: Nothing</li>
675 <div class="section">
676 <h2><a id="semantics-modifiers" name="semantics-modifiers"><span id="modifiers"></span>Semantics: modifiers</a></h2>
678 <li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">swap(</span> <span class="pre">reversible_ptr_container&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
681 <li>Effects: Swaps the content of the two containers</li>
682 <li>Throws: Nothing</li>
686 <li><p class="first"><tt class="docutils literal"><span class="pre">void</span> <span class="pre">clear();</span></tt></p>
689 <li>Effects: Destroys all object of the container</li>
690 <li>Postconditions: <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
691 <li>Throws: Nothing</li>
695 <li><p class="first"><tt class="docutils literal"><span class="pre">VoidPtrContainer&</span> <span class="pre">base();</span></tt></p>
697 <li><p class="first"><tt class="docutils literal"><span class="pre">const</span> <span class="pre">VoidPtrContainer&</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
700 <li>Returns: a reference to the wrapped container</li>
706 <div class="section">
707 <h2><a id="semantics-pointer-container-requirements" name="semantics-pointer-container-requirements"><span id="pointer-container-requirements"></span>Semantics: pointer container requirements</a></h2>
709 <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>
712 <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>
713 <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>
714 <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>
715 <li>Exception safety: Strong guarantee</li>
719 <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">iterator</span> <span class="pre">position,</span> <span class="pre">std::auto_ptr<U></span> <span class="pre">x</span> <span class="pre">);</span></tt></p>
722 <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>
726 <li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr<</span> <span class="pre">reversible_ptr_container</span> <span class="pre">></span> <span class="pre">clone()</span> <span class="pre">const;</span></tt></p>
729 <li>Effects: Returns a deep copy of the container</li>
730 <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>
731 <li>Complexity: Linear</li>
735 <li><p class="first"><tt class="docutils literal"><span class="pre">std::auto_ptr<</span> <span class="pre">reversible_ptr_container</span> <span class="pre">></span> <span class="pre">release();</span></tt></p>
738 <li>Effects: Releases ownership of the container. This is a useful way of returning a container from a function.</li>
739 <li>Postconditions: <tt class="docutils literal"><span class="pre">empty()</span> <span class="pre">==</span> <span class="pre">true</span></tt></li>
740 <li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if the return value cannot be allocated</li>
741 <li>Exception safety: Strong guarantee</li>
745 <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>
748 <li>Requirements: <tt class="docutils literal"><span class="pre">not</span> <span class="pre">empty();</span></tt></li>
749 <li>Effects: Releases ownership of the pointer referred to by position</li>
750 <li>Postconditions: <tt class="docutils literal"><span class="pre">size()</span></tt> is one less</li>
751 <li>Throws: <tt class="docutils literal"><span class="pre">bad_ptr_container_operation</span></tt> if the container is empty</li>
752 <li>Exception safety: Strong guarantee</li>
758 <div class="section">
759 <h2><a id="semantics-comparison" name="semantics-comparison"><span id="comparison"></span>Semantics: comparison</a></h2>
760 <p>These functions compare the underlying range of objects.
762 <pre class="literal-block">
763 operation( const ptr_container& l, const ptr_container& r );
765 <p>has the effect one would expect of normal standard containers. Hence
766 objects are compared and not the pointers to objects.</p>
768 <div class="section">
769 <h2><a id="semantics-cloneability" name="semantics-cloneability"><span id="cloneability"></span>Semantics: cloneability</a></h2>
771 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">T,</span> <span class="pre">class</span> <span class="pre">CloneAllocator</span> <span class="pre">></span>
772 <span class="pre">reversible_ptr_container<T,CA,VPC>*</span>
773 <span class="pre">new_clone(</span> <span class="pre">const</span> <span class="pre">reversible_ptr_container<T,CA,VPC>&</span> <span class="pre">r</span> <span class="pre">);</span></tt></p>
776 <li>Effects: <tt class="docutils literal"><span class="pre">return</span> <span class="pre">r.clone().release();</span></tt></li>
777 <li>Remarks: This function is only defined for concrete <a class="reference" href="ptr_container.html#smart-containers">pointer containers</a>, but not for
778 <a class="reference" href="ptr_container.html#smart-container-adapters">pointer container adapters</a>.</li>
784 <div class="section">
785 <h2><a id="semantics-null-predicate" name="semantics-null-predicate"><span id="null-predicate"></span>Semantics: null predicate</a></h2>
787 <li><p class="first"><tt class="docutils literal"><span class="pre">template<</span> <span class="pre">class</span> <span class="pre">Iterator</span> <span class="pre">></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>
790 <li>Requirements: <tt class="docutils literal"><span class="pre">i</span></tt> is a valid dereferencable iterator</li>
791 <li>Returns: <tt class="docutils literal"><span class="pre">*i.base()</span> <span class="pre">==</span> <span class="pre">0;</span></tt></li>
797 <div class="section">
798 <h2><a id="semantics-serialization" name="semantics-serialization"><span id="serialization"></span>Semantics: serialization</a></h2>
799 <p>All containers can be serialized by means of
800 <a class="reference" href="../../serialization/index.html">Boost.Serialization</a>. For an overview, see
801 <a class="reference" href="reference.html#serialization">Serialization of Pointer Containers</a>.</p>
803 <pre class="literal-block">
804 template<class Archive, class T, class CA, class VPC>
805 void serialize( Archive& ar, reversible_ptr_container<T,CA,VPC>& c, const unsigned int version );
809 <li>Effects: Saves or loads the container to/from the archive.</li>
810 <li>Remarks: This function is called automatically be stream operators in
811 Boost.Serialization</li>
812 <li>Exception safety: Loading gives the basic guarantee</li>
814 <hr><table class="docutils field-list" frame="void" rules="none">
815 <col class="field-name" />
816 <col class="field-body" />
818 <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>