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.14: http://docutils.sourceforge.net/" /> 7<title>Boost Pointer Container Library</title> 8<style type="text/css"> 9 10/* 11:Author: David Goodger (goodger@python.org) 12:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ 13:Copyright: This stylesheet has been placed in the public domain. 14 15Default cascading style sheet for the HTML output of Docutils. 16 17See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to 18customize this style sheet. 19*/ 20 21/* used to remove borders from tables and images */ 22.borderless, table.borderless td, table.borderless th { 23 border: 0 } 24 25table.borderless td, table.borderless th { 26 /* Override padding for "table.docutils td" with "! important". 27 The right padding separates the table cells. */ 28 padding: 0 0.5em 0 0 ! important } 29 30.first { 31 /* Override more specific margin styles with "! important". */ 32 margin-top: 0 ! important } 33 34.last, .with-subtitle { 35 margin-bottom: 0 ! important } 36 37.hidden { 38 display: none } 39 40.subscript { 41 vertical-align: sub; 42 font-size: smaller } 43 44.superscript { 45 vertical-align: super; 46 font-size: smaller } 47 48a.toc-backref { 49 text-decoration: none ; 50 color: black } 51 52blockquote.epigraph { 53 margin: 2em 5em ; } 54 55dl.docutils dd { 56 margin-bottom: 0.5em } 57 58object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { 59 overflow: hidden; 60} 61 62/* Uncomment (and remove this text!) to get bold-faced definition list terms 63dl.docutils dt { 64 font-weight: bold } 65*/ 66 67div.abstract { 68 margin: 2em 5em } 69 70div.abstract p.topic-title { 71 font-weight: bold ; 72 text-align: center } 73 74div.admonition, div.attention, div.caution, div.danger, div.error, 75div.hint, div.important, div.note, div.tip, div.warning { 76 margin: 2em ; 77 border: medium outset ; 78 padding: 1em } 79 80div.admonition p.admonition-title, div.hint p.admonition-title, 81div.important p.admonition-title, div.note p.admonition-title, 82div.tip p.admonition-title { 83 font-weight: bold ; 84 font-family: sans-serif } 85 86div.attention p.admonition-title, div.caution p.admonition-title, 87div.danger p.admonition-title, div.error p.admonition-title, 88div.warning p.admonition-title, .code .error { 89 color: red ; 90 font-weight: bold ; 91 font-family: sans-serif } 92 93/* Uncomment (and remove this text!) to get reduced vertical space in 94 compound paragraphs. 95div.compound .compound-first, div.compound .compound-middle { 96 margin-bottom: 0.5em } 97 98div.compound .compound-last, div.compound .compound-middle { 99 margin-top: 0.5em } 100*/ 101 102div.dedication { 103 margin: 2em 5em ; 104 text-align: center ; 105 font-style: italic } 106 107div.dedication p.topic-title { 108 font-weight: bold ; 109 font-style: normal } 110 111div.figure { 112 margin-left: 2em ; 113 margin-right: 2em } 114 115div.footer, div.header { 116 clear: both; 117 font-size: smaller } 118 119div.line-block { 120 display: block ; 121 margin-top: 1em ; 122 margin-bottom: 1em } 123 124div.line-block div.line-block { 125 margin-top: 0 ; 126 margin-bottom: 0 ; 127 margin-left: 1.5em } 128 129div.sidebar { 130 margin: 0 0 0.5em 1em ; 131 border: medium outset ; 132 padding: 1em ; 133 background-color: #ffffee ; 134 width: 40% ; 135 float: right ; 136 clear: right } 137 138div.sidebar p.rubric { 139 font-family: sans-serif ; 140 font-size: medium } 141 142div.system-messages { 143 margin: 5em } 144 145div.system-messages h1 { 146 color: red } 147 148div.system-message { 149 border: medium outset ; 150 padding: 1em } 151 152div.system-message p.system-message-title { 153 color: red ; 154 font-weight: bold } 155 156div.topic { 157 margin: 2em } 158 159h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, 160h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { 161 margin-top: 0.4em } 162 163h1.title { 164 text-align: center } 165 166h2.subtitle { 167 text-align: center } 168 169hr.docutils { 170 width: 75% } 171 172img.align-left, .figure.align-left, object.align-left, table.align-left { 173 clear: left ; 174 float: left ; 175 margin-right: 1em } 176 177img.align-right, .figure.align-right, object.align-right, table.align-right { 178 clear: right ; 179 float: right ; 180 margin-left: 1em } 181 182img.align-center, .figure.align-center, object.align-center { 183 display: block; 184 margin-left: auto; 185 margin-right: auto; 186} 187 188table.align-center { 189 margin-left: auto; 190 margin-right: auto; 191} 192 193.align-left { 194 text-align: left } 195 196.align-center { 197 clear: both ; 198 text-align: center } 199 200.align-right { 201 text-align: right } 202 203/* reset inner alignment in figures */ 204div.align-right { 205 text-align: inherit } 206 207/* div.align-center * { */ 208/* text-align: left } */ 209 210.align-top { 211 vertical-align: top } 212 213.align-middle { 214 vertical-align: middle } 215 216.align-bottom { 217 vertical-align: bottom } 218 219ol.simple, ul.simple { 220 margin-bottom: 1em } 221 222ol.arabic { 223 list-style: decimal } 224 225ol.loweralpha { 226 list-style: lower-alpha } 227 228ol.upperalpha { 229 list-style: upper-alpha } 230 231ol.lowerroman { 232 list-style: lower-roman } 233 234ol.upperroman { 235 list-style: upper-roman } 236 237p.attribution { 238 text-align: right ; 239 margin-left: 50% } 240 241p.caption { 242 font-style: italic } 243 244p.credits { 245 font-style: italic ; 246 font-size: smaller } 247 248p.label { 249 white-space: nowrap } 250 251p.rubric { 252 font-weight: bold ; 253 font-size: larger ; 254 color: maroon ; 255 text-align: center } 256 257p.sidebar-title { 258 font-family: sans-serif ; 259 font-weight: bold ; 260 font-size: larger } 261 262p.sidebar-subtitle { 263 font-family: sans-serif ; 264 font-weight: bold } 265 266p.topic-title { 267 font-weight: bold } 268 269pre.address { 270 margin-bottom: 0 ; 271 margin-top: 0 ; 272 font: inherit } 273 274pre.literal-block, pre.doctest-block, pre.math, pre.code { 275 margin-left: 2em ; 276 margin-right: 2em } 277 278pre.code .ln { color: grey; } /* line numbers */ 279pre.code, code { background-color: #eeeeee } 280pre.code .comment, code .comment { color: #5C6576 } 281pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } 282pre.code .literal.string, code .literal.string { color: #0C5404 } 283pre.code .name.builtin, code .name.builtin { color: #352B84 } 284pre.code .deleted, code .deleted { background-color: #DEB0A1} 285pre.code .inserted, code .inserted { background-color: #A3D289} 286 287span.classifier { 288 font-family: sans-serif ; 289 font-style: oblique } 290 291span.classifier-delimiter { 292 font-family: sans-serif ; 293 font-weight: bold } 294 295span.interpreted { 296 font-family: sans-serif } 297 298span.option { 299 white-space: nowrap } 300 301span.pre { 302 white-space: pre } 303 304span.problematic { 305 color: red } 306 307span.section-subtitle { 308 /* font-size relative to parent (h1..h6 element) */ 309 font-size: 80% } 310 311table.citation { 312 border-left: solid 1px gray; 313 margin-left: 1px } 314 315table.docinfo { 316 margin: 2em 4em } 317 318table.docutils { 319 margin-top: 0.5em ; 320 margin-bottom: 0.5em } 321 322table.footnote { 323 border-left: solid 1px black; 324 margin-left: 1px } 325 326table.docutils td, table.docutils th, 327table.docinfo td, table.docinfo th { 328 padding-left: 0.5em ; 329 padding-right: 0.5em ; 330 vertical-align: top } 331 332table.docutils th.field-name, table.docinfo th.docinfo-name { 333 font-weight: bold ; 334 text-align: left ; 335 white-space: nowrap ; 336 padding-left: 0 } 337 338/* "booktabs" style (no vertical lines) */ 339table.docutils.booktabs { 340 border: 0px; 341 border-top: 2px solid; 342 border-bottom: 2px solid; 343 border-collapse: collapse; 344} 345table.docutils.booktabs * { 346 border: 0px; 347} 348table.docutils.booktabs th { 349 border-bottom: thin solid; 350 text-align: left; 351} 352 353h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, 354h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { 355 font-size: 100% } 356 357ul.auto-toc { 358 list-style-type: none } 359 360</style> 361</head> 362<body> 363<div class="document" id="boost-pointer-container-library"> 364<h1 class="title"><img alt="Boost" src="boost.png" /> Pointer Container Library</h1> 365 366<div class="section" id="class-reversible-ptr-container"> 367<h1>Class <tt class="docutils literal">reversible_ptr_container</tt></h1> 368<p>This class is not a real class that can be found in the library. 369Its purpose is to present the general interface of all the pointer containers.</p> 370<p><strong>Hierarchy:</strong></p> 371<ul class="simple"> 372<li><tt class="docutils literal">reversible_ptr_container</tt><ul> 373<li><a class="reference external" href="ptr_sequence_adapter.html">ptr_sequence_adapter</a><ul> 374<li><a class="reference external" href="ptr_vector.html">ptr_vector</a></li> 375<li><a class="reference external" href="ptr_list.html">ptr_list</a></li> 376<li><a class="reference external" href="ptr_deque.html">ptr_deque</a></li> 377<li><a class="reference external" href="ptr_array.html">ptr_array</a></li> 378</ul> 379</li> 380<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul> 381<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li> 382<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li> 383<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li> 384<li><a class="reference external" href="ptr_multimap_adapter.html">ptr_multi_map_adapter</a><ul> 385<li><a class="reference external" href="ptr_set.html">ptr_set</a></li> 386<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li> 387<li><a class="reference external" href="ptr_map.html">ptr_map</a></li> 388<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li> 389</ul> 390</li> 391</ul> 392</li> 393</ul> 394</li> 395</ul> 396<p><strong>Navigate:</strong></p> 397<ul class="simple"> 398<li><a class="reference external" href="ptr_container.html">home</a></li> 399<li><a class="reference external" href="reference.html">reference</a></li> 400</ul> 401<p><strong>synopsis:</strong></p> 402<pre class="literal-block"> 403namespace boost 404{ 405 template 406 < 407 class T, 408 class CloneAllocator, 409 class VoidPtrContainer 410 > 411 class reversible_ptr_container 412 { 413 public: // <a class="reference internal" href="#typedefs">typedefs</a> 414 typedef T* value_type; 415 typedef T& reference; 416 typedef const T& const_reference; 417 typedef <em>implementation defined</em> iterator; 418 typedef <em>implementation defined</em> const_iterator; 419 typedef typename VoidPtrContainer::differnce_type difference_type; 420 typedef typename VoidPtrContainer::size_type size_type; 421 typedef typename VoidPtrContainer::allocator_type allocator_type; 422 typedef <em>implementation defined</em> reverse_iterator; 423 typedef <em>implementation defined</em> const_reverse_iterator; 424 typedef <em>implementation defined</em> auto_type; 425 426 public: // <a class="reference internal" href="#construct-copy-destroy">construct/copy/destroy</a> 427 reversible_ptr_container(); 428 explicit reversible_ptr_container( const reversible_ptr_container& r ); 429 template< class Derived > 430 explicit reversible_ptr_container( const reversible_ptr_container<Derived>& r ); 431 explicit reversible_ptr_container( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><reversible_ptr_container> r ); 432 template< class InputIterator > 433 reversible_ptr_container( InputIterator first, InputIterator last ); 434 435 ~reversible_ptr_container(); 436 437 reversible_ptr_container& operator=( const reversible_ptr_container& r ); 438 template<class Derived> 439 reversible_ptr_container& operator=( const reversible_ptr_container<Derived>& r ); 440 reversible_ptr_container& operator=( <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><reversible_ptr_container> r ); 441 allocator_type get_allocator() const; 442 443 public: // <a class="reference internal" href="#iterators">iterators</a> 444 iterator begin(); 445 const_iterator begin() const; 446 iterator end(); 447 const_iterator end() const; 448 reverse_iterator rbegin(); 449 const_reverse_iterator rbegin() const; 450 reverse_iterator rend(); 451 const_reverse_iterator rend() const; 452 453 public: // <a class="reference internal" href="#capacity">capacity</a> 454 size_type size() const; 455 size_type max_size() const; 456 bool empty() const; 457 458 public: // <a class="reference internal" href="#modifiers">modifiers</a> 459 void swap( reversible_ptr_container& r ); 460 void clear(): 461 VoidPtrContainer& base(); 462 const VoidPtrContainer& base() const; 463 464 public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a> 465 auto_type replace( iterator position, T* x ); 466 template< class U > 467 auto_type replace( iterator position, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><U> x ); 468 <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><reversible_ptr_container> clone() const; 469 <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><reversible_ptr_container> release(); 470 auto_type release( iterator position ); 471 472 }; // class 'reversible_ptr_container' 473 474 // <a class="reference internal" href="#comparison">comparison</a> 475 template < class T, class CA, class VPC > 476 bool operator==( const reversible_ptr_container<T,CA,VPC>& x, 477 const reversible_ptr_container<T,CA,VPC>& y); 478 479 template < class T, class CA, class VPC > 480 bool operator<( const reversible_ptr_container<T,CA,VPC>& x, 481 const reversible_ptr_container<T,CA,VPC>& y); 482 483 template < class T, class CA, class VPC > 484 bool operator!=( const reversible_ptr_container<T,CA,VPC>& x, 485 const reversible_ptr_container<T,CA,VPC>& y); 486 487 template < class T, class CA, class VPC > 488 bool operator>( const reversible_ptr_container<T,CA,VPC>& x, 489 const reversible_ptr_container<T,CA,VPC>& y); 490 491 template < class T, class CA, class VPC > 492 bool operator>=( const reversible_ptr_container<T,CA,VPC>& x, 493 const reversible_ptr_container<T,CA,VPC>& y); 494 495 template < class T, class CA, class VPC > 496 bool operator<=( const reversible_ptr_container<T,CA,VPC>& x, 497 const reversible_ptr_container<T,CA,VPC>& y); 498 499 template< class T, class CA, class VPC > 500 void swap( reversible_ptr_container<T,CA,VPC>& x, 501 reversible_ptr_container<T,CA,VPC>& y ); 502 503 // <a class="reference internal" href="#cloneability">cloneability</a> 504 template< class T, class CA, class VPC > 505 reversible_ptr_container<T,CA,VPC>* 506 new_clone( const reversible_ptr_container<T,CA,VPC>& r ); 507 508 // <a class="reference internal" href="#null-predicate">null predicate</a> 509 template< class Iterator > 510 bool is_null( Iterator i ); 511 512 // <a class="reference internal" href="#serialization">serialization</a> 513 template<class Archive, class T, class CA, class VPC> 514 void serialize( Archive& ar, reversible_ptr_container<T,CÁ,VPC>& c, const unsigned int version ); 515 516 517} // namespace 'boost' 518</pre> 519</div> 520<div class="section" id="semantics"> 521<h1>Semantics</h1> 522<div class="section" id="semantics-typedefs"> 523<span id="typedefs"></span><h2>Semantics: typedefs</h2> 524<p>Notice how these two types differ:</p> 525<ul> 526<li><p class="first"><tt class="docutils literal">typedef T* value_type;</tt></p> 527<blockquote> 528<ul class="simple"> 529<li>notice this has pointer type</li> 530</ul> 531</blockquote> 532</li> 533<li><p class="first"><tt class="docutils literal">typedef T& reference;</tt></p> 534<blockquote> 535<ul class="simple"> 536<li>notice this is not a pointer type</li> 537</ul> 538</blockquote> 539</li> 540</ul> 541<p>This is done to be able to add pointers directly 542to the container, but to hide the pointers externally.</p> 543<!-- - ``typedef *implementation defined* object_type;`` 544- this is ``T`` for sequences and sets 545- this is ``std::pair<const Key, void*>`` for maps --> 546<p>Also notice that</p> 547<ul class="simple"> 548<li><tt class="docutils literal">typedef ... iterator</tt></li> 549</ul> 550<p>allows one to iterate over <tt class="docutils literal">T&</tt> objects, not <tt class="docutils literal">T*</tt>. 551Note that:</p> 552<pre class="literal-block"> 553iterator i = ...; 554i.base(); 555</pre> 556<p>returns an iterator that allows one to iterate over <tt class="docutils literal">void*</tt> 557elements (<em>this is very rarely needed and you should not use the 558functionality unless you know what you are doing</em>).</p> 559<ul class="simple"> 560<li><tt class="docutils literal">typedef ... auto_type</tt></li> 561</ul> 562<p>This declaration hides a pointer pointer type. You can rely on the following 563operations</p> 564<pre class="literal-block"> 565T* operator->() const; 566T& operator*() const; 567T* release(); 568~auto_type(); 569operator <em>implementation-defined bool</em>(); 570</pre> 571<p>The destructor will delete the stored object <em>using the clone allocator of the container</em> 572(this explains why we cannot use <tt class="docutils literal"><span class="pre">std::auto_ptr<T></span></tt> nor <tt class="docutils literal"><span class="pre">std::unique_ptr<T></span></tt>). It might help to 573think 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><T></span></tt>. You can also return 574the pointer from a function or assign it to another pointer via the <tt class="docutils literal">move()</tt> 575function</p> 576<pre class="literal-block"> 577auto_type ptr = ...; 578auto_type other = boost::ptr_container::move( ptr ); 579return boost::ptr_container::move( other ); 580</pre> 581</div> 582<div class="section" id="semantics-construct-copy-destroy"> 583<span id="construct-copy-destroy"></span><h2>Semantics: construct/copy/destroy</h2> 584<ul> 585<li><p class="first"><tt class="docutils literal"><span class="pre">reversible_ptr_container();</span></tt></p> 586<blockquote> 587<ul class="simple"> 588<li>Effects: Constructs an empty container</li> 589<li>Postconditions: <tt class="docutils literal">size() == 0</tt></li> 590</ul> 591</blockquote> 592</li> 593</ul> 594<!-- - ``reversible_ptr_container( size_type n, const T& x );`` 595 596- Effects: Constructs a container with ``n`` clones of ``x`` 597 598- Postconditions: ``size() == n`` --> 599<ul> 600<li><p class="first"><tt class="docutils literal">explicit reversible_ptr_container( const reversible_ptr_container& r );</tt></p> 601<blockquote> 602<ul class="simple"> 603<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal">r</tt></li> 604</ul> 605</blockquote> 606</li> 607<li><p class="first"><tt class="docutils literal">template< class Derived > explicit reversible_ptr_container( const reversible_ptr_container<Derived>& r );</tt></p> 608<blockquote> 609<ul class="simple"> 610<li>Effects: Constructs a container by cloning all elements of <tt class="docutils literal">r</tt></li> 611<li>Requirements: <tt class="docutils literal">Derived</tt> is derived from <tt class="docutils literal">T</tt></li> 612</ul> 613</blockquote> 614</li> 615<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><</span> reversible_ptr_container > r );</tt></p> 616<blockquote> 617<ul class="simple"> 618<li>Effects: Constructs a container by taking ownership of the supplied pointers</li> 619</ul> 620</blockquote> 621</li> 622<li><p class="first"><tt class="docutils literal">template< class InputIterator ></tt> 623<tt class="docutils literal">reversible_ptr_container( InputIterator first, InputIterator last );</tt></p> 624<blockquote> 625<ul class="simple"> 626<li>Requirements: <tt class="docutils literal">(first,last]</tt> is a valid range</li> 627<li>Effects: Constructs a container with a cloned range of <tt class="docutils literal">(first,last]</tt></li> 628<li>Postconditions: <tt class="docutils literal">size() == <span class="pre">std::distance(</span> first, last )</tt></li> 629</ul> 630</blockquote> 631</li> 632<li><p class="first"><tt class="docutils literal"><span class="pre">~reversible_ptr_container();</span></tt></p> 633<blockquote> 634<ul class="simple"> 635<li>Effects: Deletes the stored objects via the clone allocator</li> 636<li>Throws: Nothing</li> 637</ul> 638</blockquote> 639</li> 640<li><p class="first"><tt class="docutils literal">reversible_ptr_container& operator=( const reversible_ptr_container& r );</tt></p> 641<blockquote> 642<ul class="simple"> 643<li>Effects: Assigns a clone of <tt class="docutils literal">r</tt></li> 644<li>Exception safety: strong guarantee</li> 645</ul> 646</blockquote> 647</li> 648<li><p class="first"><tt class="docutils literal">template<class Derived> reversible_ptr_container& operator=( const reversible_ptr_container<Derived>& r );</tt></p> 649<blockquote> 650<ul class="simple"> 651<li>Effects: Assigns a clone of <tt class="docutils literal">r</tt></li> 652<li>Requirements: <tt class="docutils literal">Derived</tt> is derived from <tt class="docutils literal">T</tt></li> 653<li>Exception safety: Strong guarantee</li> 654</ul> 655</blockquote> 656</li> 657<li><p class="first"><tt class="docutils literal">reversible_ptr_container& operator=( <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><reversible_ptr_container></span> r );</tt></p> 658<blockquote> 659<ul class="simple"> 660<li>Effects: Deletes the stored objects and then takes ownership of the supplied pointers</li> 661<li>Throws: Nothing</li> 662</ul> 663</blockquote> 664</li> 665<li><p class="first"><tt class="docutils literal">allocator_type get_allocator() const;</tt></p> 666<blockquote> 667<ul class="simple"> 668<li>Effects: Returns a copy of the allocator of the container object</li> 669</ul> 670</blockquote> 671</li> 672</ul> 673</div> 674<div class="section" id="semantics-iterators"> 675<span id="iterators"></span><h2>Semantics: iterators</h2> 676<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> 677<ul> 678<li><p class="first"><tt class="docutils literal">iterator <span class="pre">begin();</span></tt></p> 679</li> 680<li><p class="first"><tt class="docutils literal">const_iterator begin() const;</tt></p> 681<blockquote> 682<ul class="simple"> 683<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal">value_type T</tt></li> 684<li>Throws: Nothing</li> 685</ul> 686</blockquote> 687</li> 688<li><p class="first"><tt class="docutils literal">iterator <span class="pre">end();</span></tt></p> 689</li> 690<li><p class="first"><tt class="docutils literal">const_iterator end() const;</tt></p> 691<blockquote> 692<ul class="simple"> 693<li>Effects: Returns a mutable/non-mutable iterator with <tt class="docutils literal">value_type T</tt></li> 694<li>Throws: Nothing</li> 695</ul> 696</blockquote> 697</li> 698<li><p class="first"><tt class="docutils literal">reverse_iterator <span class="pre">rbegin();</span></tt></p> 699</li> 700<li><p class="first"><tt class="docutils literal">const_reverse_iterator rbegin() const;</tt></p> 701<blockquote> 702<ul class="simple"> 703<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal">value_type T</tt></li> 704<li>Throws: Nothing</li> 705</ul> 706</blockquote> 707</li> 708<li><p class="first"><tt class="docutils literal">reverse_iterator <span class="pre">rend();</span></tt></p> 709</li> 710<li><p class="first"><tt class="docutils literal">const_reverse_iterator rend() const;</tt></p> 711<blockquote> 712<ul class="simple"> 713<li>Effects: Returns a mutable/non-mutable reverse iterator with <tt class="docutils literal">value_type T</tt></li> 714<li>Throws: Nothing</li> 715</ul> 716</blockquote> 717</li> 718</ul> 719</div> 720<div class="section" id="semantics-capacity"> 721<span id="capacity"></span><h2>Semantics: capacity</h2> 722<ul> 723<li><p class="first"><tt class="docutils literal">size_type size() const;</tt></p> 724<blockquote> 725<ul class="simple"> 726<li>Effects: Returns the number of stored elements</li> 727<li>Throws: Nothing</li> 728</ul> 729</blockquote> 730</li> 731<li><p class="first"><tt class="docutils literal">size_type max_size() const;</tt></p> 732<blockquote> 733<ul class="simple"> 734<li>Effects: Returns the maximum number of stored elements</li> 735<li>Throws: Nothing</li> 736</ul> 737</blockquote> 738</li> 739<li><p class="first"><tt class="docutils literal">bool empty() const;</tt></p> 740<blockquote> 741<ul class="simple"> 742<li>Effects: Returns whether the container is empty or not</li> 743<li>Throws: Nothing</li> 744</ul> 745</blockquote> 746</li> 747</ul> 748</div> 749<div class="section" id="semantics-modifiers"> 750<span id="modifiers"></span><h2>Semantics: modifiers</h2> 751<ul> 752<li><p class="first"><tt class="docutils literal">void swap( reversible_ptr_container& r );</tt></p> 753<blockquote> 754<ul class="simple"> 755<li>Effects: Swaps the content of the two containers</li> 756<li>Throws: Nothing</li> 757</ul> 758</blockquote> 759</li> 760<li><p class="first"><tt class="docutils literal">void <span class="pre">clear();</span></tt></p> 761<blockquote> 762<ul class="simple"> 763<li>Effects: Destroys all object of the container</li> 764<li>Postconditions: <tt class="docutils literal">empty() == true</tt></li> 765<li>Throws: Nothing</li> 766</ul> 767</blockquote> 768</li> 769<li><p class="first"><tt class="docutils literal">VoidPtrContainer& <span class="pre">base();</span></tt></p> 770</li> 771<li><p class="first"><tt class="docutils literal">const VoidPtrContainer& base() const;</tt></p> 772<blockquote> 773<ul class="simple"> 774<li>Returns: a reference to the wrapped container</li> 775</ul> 776</blockquote> 777</li> 778</ul> 779</div> 780<div class="section" id="semantics-pointer-container-requirements"> 781<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2> 782<ul> 783<li><p class="first"><tt class="docutils literal">auto_type replace( iterator position, T* x );</tt></p> 784<blockquote> 785<ul class="simple"> 786<li>Requirements: <tt class="docutils literal">not empty() and x != 0</tt></li> 787<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> 788<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> 789<li>Exception safety: Strong guarantee</li> 790</ul> 791</blockquote> 792</li> 793<li><p class="first"><tt class="docutils literal">template< class U > auto_type replace( iterator position, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><U></span> x );</tt></p> 794<blockquote> 795<ul class="simple"> 796<li>Effects: <tt class="docutils literal">return replace( position, x.release() );</tt></li> 797</ul> 798</blockquote> 799</li> 800<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><</span> reversible_ptr_container > clone() const;</tt></p> 801<blockquote> 802<ul class="simple"> 803<li>Effects: Returns a deep copy of the container</li> 804<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> 805<li>Complexity: Linear</li> 806</ul> 807</blockquote> 808</li> 809<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><</span> reversible_ptr_container > <span class="pre">release();</span></tt></p> 810<blockquote> 811<ul class="simple"> 812<li>Effects: Releases ownership of the container. This is a useful way of returning a container from a function.</li> 813<li>Postconditions: <tt class="docutils literal">empty() == true</tt></li> 814<li>Throws: <tt class="docutils literal"><span class="pre">std::bad_alloc</span></tt> if the return value cannot be allocated</li> 815<li>Exception safety: Strong guarantee</li> 816</ul> 817</blockquote> 818</li> 819<li><p class="first"><tt class="docutils literal">auto_type release( iterator position );</tt></p> 820<blockquote> 821<ul class="simple"> 822<li>Requirements: <tt class="docutils literal">not <span class="pre">empty();</span></tt></li> 823<li>Effects: Releases ownership of the pointer referred to by position</li> 824<li>Postconditions: <tt class="docutils literal">size()</tt> is one less</li> 825<li>Throws: <tt class="docutils literal">bad_ptr_container_operation</tt> if the container is empty</li> 826<li>Exception safety: Strong guarantee</li> 827</ul> 828</blockquote> 829</li> 830</ul> 831</div> 832<div class="section" id="semantics-comparison"> 833<span id="comparison"></span><h2>Semantics: comparison</h2> 834<p>These functions compare the underlying range of objects. 835So</p> 836<pre class="literal-block"> 837operation( const ptr_container& l, const ptr_container& r ); 838</pre> 839<p>has the effect one would expect of normal standard containers. Hence 840objects are compared and not the pointers to objects.</p> 841</div> 842<div class="section" id="semantics-cloneability"> 843<span id="cloneability"></span><h2>Semantics: cloneability</h2> 844<ul> 845<li><p class="first"><tt class="docutils literal">template< class T, class CloneAllocator > 846reversible_ptr_container<T,CA,VPC>* 847new_clone( const reversible_ptr_container<T,CA,VPC>& r );</tt></p> 848<blockquote> 849<ul class="simple"> 850<li>Effects: <tt class="docutils literal">return <span class="pre">r.clone().release();</span></tt></li> 851<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 852<a class="reference external" href="ptr_container.html#smart-container-adapters">pointer container adapters</a>.</li> 853</ul> 854</blockquote> 855</li> 856</ul> 857</div> 858<div class="section" id="semantics-null-predicate"> 859<span id="null-predicate"></span><h2>Semantics: null predicate</h2> 860<ul> 861<li><p class="first"><tt class="docutils literal">template< class Iterator > bool is_null( Iterator i );</tt></p> 862<blockquote> 863<ul class="simple"> 864<li>Requirements: <tt class="docutils literal">i</tt> is a valid dereferencable iterator</li> 865<li>Returns: <tt class="docutils literal">*i.base() == 0;</tt></li> 866</ul> 867</blockquote> 868</li> 869</ul> 870</div> 871<div class="section" id="semantics-serialization"> 872<span id="serialization"></span><h2>Semantics: serialization</h2> 873<p>All containers can be serialized by means of 874<a class="reference external" href="../../serialization/index.html">Boost.Serialization</a>. For an overview, see 875<a class="reference external" href="reference.html#serialization">Serialization of Pointer Containers</a>.</p> 876<blockquote> 877<pre class="literal-block"> 878template<class Archive, class T, class CA, class VPC> 879void serialize( Archive& ar, reversible_ptr_container<T,CA,VPC>& c, const unsigned int version ); 880</pre> 881</blockquote> 882<ul class="simple"> 883<li>Effects: Saves or loads the container to/from the archive.</li> 884<li>Remarks: This function is called automatically be stream operators in 885Boost.Serialization</li> 886<li>Exception safety: Loading gives the basic guarantee</li> 887</ul> 888<hr><table class="docutils field-list" frame="void" rules="none"> 889<col class="field-name" /> 890<col class="field-body" /> 891<tbody valign="top"> 892<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> 893</tr> 894</tbody> 895</table> 896</div> 897</div> 898</div> 899</body> 900</html> 901