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-ptr-multimap-adapter"> 367<h1>Class <tt class="docutils literal">ptr_multimap_adapter</tt></h1> 368<p>This class is used to build custom pointer containers with 369an underlying multimap-like container. The interface of the class is an extension 370of the interface from <tt class="docutils literal">associative_ptr_container</tt>.</p> 371<p><strong>Hierarchy:</strong></p> 372<ul class="simple"> 373<li><a class="reference external" href="reversible_ptr_container.html">reversible_ptr_container</a><ul> 374<li><a class="reference external" href="associative_ptr_container.html">associative_ptr_container</a><ul> 375<li><a class="reference external" href="ptr_set_adapter.html">ptr_set_adapter</a></li> 376<li><a class="reference external" href="ptr_multiset_adapter.html">ptr_multiset_adapter</a></li> 377<li><a class="reference external" href="ptr_map_adapter.html">ptr_map_adapter</a></li> 378<li><tt class="docutils literal">ptr_multi_map_adapter</tt><ul> 379<li><a class="reference external" href="ptr_set.html">ptr_set</a></li> 380<li><a class="reference external" href="ptr_multiset.html">ptr_multi_set</a></li> 381<li><a class="reference external" href="ptr_map.html">ptr_map</a></li> 382<li><a class="reference external" href="ptr_multimap.html">ptr_multimap</a></li> 383</ul> 384</li> 385</ul> 386</li> 387</ul> 388</li> 389</ul> 390<p><strong>Navigate:</strong></p> 391<ul class="simple"> 392<li><a class="reference external" href="ptr_container.html">home</a></li> 393<li><a class="reference external" href="reference.html">reference</a></li> 394</ul> 395<p><strong>Synopsis:</strong></p> 396<pre class="literal-block"> 397namespace boost 398{ 399 template 400 < 401 T, 402 class VoidPtrMultiMap, 403 class CloneAllocator = heap_clone_allocator 404 > 405 class ptr_multimap_adapter 406 { 407 public: // <a class="reference internal" href="#typedefs">typedefs</a> 408 typedef VoidPtrMap::key_type key_type; 409 typedef T* mapped_type; 410 typedef T& mapped_reference; 411 typedef const T& const_mapped_reference; 412 typedef ... value_type; 413 typedef ... reference; 414 typedef ... const_reference; 415 typedef ... pointer; 416 typedef ... const_pointer; 417 418 public: // <a class="reference internal" href="#modifiers">modifiers</a> 419 iterator insert( key_type& k, T* x ); 420 template< class U > 421 iterator insert( const key_type&, <a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><U> x ); 422 423 public: // <a class="reference internal" href="#pointer-container-requirements">pointer container requirements</a> 424 void transfer( iterator object, ptr_multimap_adapter& from ); 425 size_type transfer( iterator first, iterator last, ptr_multimap_adapter& from ); 426 template< class Range > 427 size_type transfer( const Range& r, ptr_multimap_adapter& from ); 428 void transfer( ptr_multimap_adapter& from ); 429 430 }; // class 'ptr_multimap_adapter' 431 432} // namespace 'boost' 433</pre> 434</div> 435<div class="section" id="semantics"> 436<h1>Semantics</h1> 437<p>. <span class="target" id="typedefs">typedefs</span>:</p> 438<div class="section" id="semantics-typedefs"> 439<h2>Semantics: typedefs</h2> 440<p>The following types are implementation defined:</p> 441<pre class="literal-block"> 442typedef ... value_type; 443typedef ... reference; 444typedef ... const_reference; 445typedef ... pointer; 446typedef ... const_pointer; 447</pre> 448<p>However, the structure of the type mimics <tt class="docutils literal"><span class="pre">std::pair</span></tt> s.t. one 449can use <tt class="docutils literal">first</tt> and <tt class="docutils literal">second</tt> members. The reference-types 450are not real references and the pointer-types are not real pointers. 451However, one may still write</p> 452<pre class="literal-block"> 453map_type::value_type a_value = *m.begin(); 454a_value.second->foo(); 455map_type::reference a_reference = *m.begin(); 456a_reference.second->foo(); 457map_type::const_reference a_creference = *const_begin(m); 458map_type::pointer a_pointer = &*m.begin(); 459a_pointer->second->foo(); 460map_type::const_pointer a_cpointer = &*const_begin(m); 461</pre> 462<p>The difference compared to <tt class="docutils literal"><span class="pre">std::map<Key,T*></span></tt> is that constness 463is propagated to the pointer (that is, to <tt class="docutils literal">second</tt>) in <tt class="docutils literal">const_itertor</tt>.</p> 464</div> 465<div class="section" id="semantics-modifiers"> 466<span id="modifiers"></span><h2>Semantics: modifiers</h2> 467<ul> 468<li><p class="first"><tt class="docutils literal">iterator insert( key_type& k, T* x );</tt></p> 469<blockquote> 470<ul class="simple"> 471<li>Requirements: <tt class="docutils literal">x != 0</tt></li> 472<li>Effects: Takes ownership of <tt class="docutils literal">x</tt> and returns an iterator pointing to it.</li> 473<li>Throws: bad_pointer if <tt class="docutils literal">x == 0</tt></li> 474<li>Exception safety: Strong guarantee</li> 475</ul> 476</blockquote> 477</li> 478<li><p class="first"><tt class="docutils literal">template< class U > iterator insert( const key_type& k, <span class="pre"><a class="reference external" href="compatible_smart_ptr.html"><em>compatible-smart-ptr</em></a><U></span> x );</tt></p> 479<blockquote> 480<ul class="simple"> 481<li>Equivalent to (but without the <tt class="docutils literal">const_cast</tt>): <tt class="docutils literal">return insert( <span class="pre">const_cast<key_type&>(k),</span> x.release() );</tt></li> 482</ul> 483</blockquote> 484</li> 485</ul> 486<!-- - ``iterator insert( key_type& k, const_reference x );`` 487 488- Effects: ``return insert( allocate_clone( x ) );`` 489 490- Exception safety: Strong guarantee --> 491<span class="target" id="lookup"></span><!-- Semantics: lookup 492^^^^^^^^^^^^^^^^^ 493 494- ``reference operator[]( const Key& key );`` 495- ``const_reference operator[]( const Key& key ) const;`` 496 497 - Requirements: the key exists 498 499 - Effects: returns the object with key ``key`` 500 501 - Throws: ``bad_ptr_container_operation`` if the key does not exist --> 502</div> 503<div class="section" id="semantics-pointer-container-requirements"> 504<span id="pointer-container-requirements"></span><h2>Semantics: pointer container requirements</h2> 505<ul> 506<li><p class="first"><tt class="docutils literal">void transfer( iterator object, ptr_multimap_adapter& from );</tt></p> 507<blockquote> 508<ul class="simple"> 509<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li> 510<li>Effects: Inserts the object defined by <tt class="docutils literal">object</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li> 511<li>Postconditions: <tt class="docutils literal">size()</tt> is one more, <tt class="docutils literal">from.size()</tt> is one less.</li> 512<li>Exception safety: Strong guarantee</li> 513</ul> 514</blockquote> 515</li> 516<li><p class="first"><tt class="docutils literal">void transfer( iterator first, iterator last, ptr_multimap_adapter& from );</tt></p> 517<blockquote> 518<ul class="simple"> 519<li>Requirements: <tt class="docutils literal">not from.empty()</tt></li> 520<li>Effects: Inserts the objects defined by the range <tt class="docutils literal">[first,last)</tt> into the container and remove it from <tt class="docutils literal">from</tt>.</li> 521<li>Postconditions: Let <tt class="docutils literal">N == <span class="pre">std::distance(first,last);</span></tt> then <tt class="docutils literal">size()</tt> is <tt class="docutils literal">N</tt> more, <tt class="docutils literal">from.size()</tt> is <tt class="docutils literal">N</tt> less.</li> 522<li>Exception safety: Basic guarantee</li> 523</ul> 524</blockquote> 525</li> 526<li><p class="first"><tt class="docutils literal">template< class Range > void transfer( const Range& r, ptr_multimap_adapter& from );</tt></p> 527<blockquote> 528<ul class="simple"> 529<li>Effects: <tt class="docutils literal">transfer( <span class="pre">boost::begin(r),</span> <span class="pre">boost::end(r),</span> from );</tt></li> 530</ul> 531</blockquote> 532</li> 533<li><p class="first"><tt class="docutils literal">void transfer( ptr_multimap_adapter& from );</tt></p> 534<blockquote> 535<ul class="simple"> 536<li>Effects: <tt class="docutils literal">transfer( <span class="pre">from.begin(),</span> <span class="pre">from.end(),</span> from );</tt>.</li> 537<li>Postconditions: <tt class="docutils literal"><span class="pre">from.empty();</span></tt></li> 538<li>Exception safety: Basic guarantee</li> 539</ul> 540</blockquote> 541</li> 542</ul> 543<hr><table class="docutils field-list" frame="void" rules="none"> 544<col class="field-name" /> 545<col class="field-body" /> 546<tbody valign="top"> 547<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td> 548</tr> 549</tbody> 550</table> 551</div> 552</div> 553</div> 554</body> 555</html> 556