1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Bimap Reference</title> 5<link rel="stylesheet" href="../../boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Bimap"> 8<link rel="up" href="../reference.html" title="Reference"> 9<link rel="prev" href="../reference.html" title="Reference"> 10<link rel="next" href="set_of_reference.html" title="set_of Reference"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_of_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_bimap.reference.bimap_reference"></a><a class="link" href="bimap_reference.html" title="Bimap Reference">Bimap Reference</a> 28</h3></div></div></div> 29<div class="toc"><dl class="toc"> 30<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.view_concepts">View 31 concepts</a></span></dt> 32<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.complexity_signature">Complexity 33 signature</a></span></dt> 34<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.set_type_specification">Set 35 type specification</a></span></dt> 36<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.tags">Tags</a></span></dt> 37<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.header__boost_bimap_bimap_hpp__synopsis">Header 38 "boost/bimap/bimap.hpp" synopsis</a></span></dt> 39<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap">Class 40 template bimap</a></span></dt> 41<dd><dl> 42<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.complexity">Complexity</a></span></dt> 43<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.instantiation_types">Instantiation 44 types</a></span></dt> 45<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.nested_types">Nested 46 types</a></span></dt> 47<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.constructors__copy_and_assignment">Constructors, 48 copy and assignment</a></span></dt> 49<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.projection_operations">Projection 50 operations</a></span></dt> 51<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.support_for_user_defined_names">Support 52 for user defined names</a></span></dt> 53<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.serialization">Serialization</a></span></dt> 54</dl></dd> 55</dl></div> 56<div class="section"> 57<div class="titlepage"><div><div><h4 class="title"> 58<a name="boost_bimap.reference.bimap_reference.view_concepts"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.view_concepts" title="View concepts">View 59 concepts</a> 60</h4></div></div></div> 61<p> 62 <code class="computeroutput"><span class="identifier">bimap</span></code> instantiations comprise 63 two side views and an view of the relation specified at compile time. Each 64 view allows read-write access to the elements contained in a definite manner, 65 mathing an STL container signature. 66 </p> 67<p> 68 Views are not isolated objects and so cannot be constructed on their own; 69 rather they are an integral part of a <code class="computeroutput"><span class="identifier">bimap</span></code>. 70 The name of the view class implementation proper is never directly exposed 71 to the user, who has access only to the associated view type specifier. 72 </p> 73<p> 74 Insertion and deletion of elements are always performed through the appropriate 75 interface of any of the three views of the <code class="computeroutput"><span class="identifier">bimap</span></code>; 76 these operations do, however, have an impact on all other views as well: 77 for instance, insertion through a given view may fail because there exists 78 another view that forbids the operation in order to preserve its invariant 79 (such as uniqueness of elements). The global operations performed jointly 80 in the any view can be reduced to six primitives: 81 </p> 82<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 83<li class="listitem"> 84 copying 85 </li> 86<li class="listitem"> 87 insertion of an element 88 </li> 89<li class="listitem"> 90 hinted insertion, where a pre-existing element is suggested in order 91 to improve the efficiency of the operation 92 </li> 93<li class="listitem"> 94 deletion of an element 95 </li> 96<li class="listitem"> 97 replacement of the value of an element, which may trigger the rearrangement 98 of this element in one or more views, or may forbid the replacement 99 </li> 100<li class="listitem"> 101 modification of an element, and its subsequent rearrangement/banning 102 by the various views 103 </li> 104</ul></div> 105<p> 106 The last two primitives deserve some further explanation: in order to guarantee 107 the invariants associated to each view (e.g. some definite ordering) elements 108 of a <code class="computeroutput"><span class="identifier">bimap</span></code> are not mutable. 109 To overcome this restriction, the views expose member functions for updating 110 and modifying, which allows for the mutation of elements in a controlled 111 fashion. 112 </p> 113</div> 114<div class="section"> 115<div class="titlepage"><div><div><h4 class="title"> 116<a name="boost_bimap.reference.bimap_reference.complexity_signature"></a><a name="complexity_signature_explanation"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.complexity_signature" title="Complexity signature">Complexity 117 signature</a> 118</h4></div></div></div> 119<p> 120 Some member functions of a view interface are implemented by global primitives 121 from the above list. The complexity of these operations thus depends on 122 all views of a given <code class="computeroutput"><span class="identifier">bimap</span></code>, 123 not just the currently used view. 124 </p> 125<p> 126 In order to establish complexity estimates, a view is characterised by 127 its complexity signature, consisting of the following associated functions 128 on the number of elements: 129 </p> 130<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 131<li class="listitem"> 132 <code class="computeroutput"><span class="identifier">c</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 133 copying 134 </li> 135<li class="listitem"> 136 <code class="computeroutput"><span class="identifier">i</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 137 insertion 138 </li> 139<li class="listitem"> 140 <code class="computeroutput"><span class="identifier">h</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 141 hinted insertion 142 </li> 143<li class="listitem"> 144 <code class="computeroutput"><span class="identifier">d</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 145 deletion 146 </li> 147<li class="listitem"> 148 <code class="computeroutput"><span class="identifier">r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 149 replacement 150 </li> 151<li class="listitem"> 152 <code class="computeroutput"><span class="identifier">m</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>: 153 modifying 154 </li> 155</ul></div> 156<p> 157 If the collection type of the relation is <code class="computeroutput"><span class="identifier">left_based</span></code> 158 or <code class="computeroutput"><span class="identifier">right_based</span></code>, and we 159 use an <code class="computeroutput"><span class="identifier">l</span></code> subscript to denote 160 the left view and an <code class="computeroutput"><span class="identifier">r</span></code> 161 for the right view, then the insertion of an element in such a container 162 is of complexity <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">i_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)+</span><span class="identifier">i_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">))</span></code>, 163 where n is the number of elements. If the collection type of relation is 164 not side-based, then there is an additional term to add that is contributed 165 by the collection type of relation view. Using <code class="computeroutput"><span class="identifier">a</span></code> 166 to denote the above view, the complexity of insertion will now be <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">i_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)+</span><span class="identifier">i_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)+</span><span class="identifier">i_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">))</span></code>. 167 To abbreviate the notation, we adopt the following definitions: 168 </p> 169<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 170<li class="listitem"> 171 <code class="computeroutput"><span class="identifier">C</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">c_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">c_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">c_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 172 </li> 173<li class="listitem"> 174 <code class="computeroutput"><span class="identifier">I</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">i_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">i_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">i_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 175 </li> 176<li class="listitem"> 177 <code class="computeroutput"><span class="identifier">H</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">h_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">h_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">h_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 178 </li> 179<li class="listitem"> 180 <code class="computeroutput"><span class="identifier">D</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">d_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">d_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">d_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 181 </li> 182<li class="listitem"> 183 <code class="computeroutput"><span class="identifier">R</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">r_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">r_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">r_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 184 </li> 185<li class="listitem"> 186 <code class="computeroutput"><span class="identifier">M</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">m_l</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">m_r</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">[</span> <span class="special">+</span> <span class="identifier">m_a</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">]</span></code> 187 </li> 188</ul></div> 189</div> 190<div class="section"> 191<div class="titlepage"><div><div><h4 class="title"> 192<a name="boost_bimap.reference.bimap_reference.set_type_specification"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.set_type_specification" title="Set type specification">Set 193 type specification</a> 194</h4></div></div></div> 195<p> 196 Set type specifiers are passed as instantiation arguments to <code class="computeroutput"><span class="identifier">bimap</span></code> and provide the information needed 197 to incorporate the corresponding views. Currently, Boost.Bimap provides 198 the collection type specifiers. The <span class="emphasis"><em>side collection type</em></span> 199 specifiers define the constraints of the two map views of the bimap. The 200 <span class="emphasis"><em>collection type of relation</em></span> specifier defines the 201 main set view constraints. If <code class="computeroutput"><span class="identifier">left_based</span></code> 202 (the default parameter) or <code class="computeroutput"><span class="identifier">right_based</span></code> 203 is used, then the collection type of relation will be based on the left 204 or right collection type correspondingly. 205 </p> 206<div class="informaltable"><table class="table"> 207<colgroup> 208<col> 209<col> 210<col> 211</colgroup> 212<thead><tr> 213<th> 214 <p> 215 Side collection type 216 </p> 217 </th> 218<th> 219 <p> 220 Collection type of relation 221 </p> 222 </th> 223<th> 224 <p> 225 Include 226 </p> 227 </th> 228</tr></thead> 229<tbody> 230<tr> 231<td> 232 <p> 233 <code class="computeroutput"><span class="identifier">set_of</span></code> 234 </p> 235 </td> 236<td> 237 <p> 238 <code class="computeroutput"><span class="identifier">set_of_relation</span></code> 239 </p> 240 </td> 241<td> 242 <p> 243 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">set_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 244 </p> 245 </td> 246</tr> 247<tr> 248<td> 249 <p> 250 <code class="computeroutput"><span class="identifier">multiset_of</span></code> 251 </p> 252 </td> 253<td> 254 <p> 255 <code class="computeroutput"><span class="identifier">multiset_of_relation</span></code> 256 </p> 257 </td> 258<td> 259 <p> 260 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">multiset_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 261 </p> 262 </td> 263</tr> 264<tr> 265<td> 266 <p> 267 <code class="computeroutput"><span class="identifier">unordered_set_of</span></code> 268 </p> 269 </td> 270<td> 271 <p> 272 <code class="computeroutput"><span class="identifier">unordered_set_of_relation</span></code> 273 </p> 274 </td> 275<td> 276 <p> 277 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">unordered_set_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 278 </p> 279 </td> 280</tr> 281<tr> 282<td> 283 <p> 284 <code class="computeroutput"><span class="identifier">unordered_multiset_of</span></code> 285 </p> 286 </td> 287<td> 288 <p> 289 <code class="computeroutput"><span class="identifier">unordered_multiset_of_relation</span></code> 290 </p> 291 </td> 292<td> 293 <p> 294 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">unordered_multiset_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 295 </p> 296 </td> 297</tr> 298<tr> 299<td> 300 <p> 301 <code class="computeroutput"><span class="identifier">list_of</span></code> 302 </p> 303 </td> 304<td> 305 <p> 306 <code class="computeroutput"><span class="identifier">list_of_relation</span></code> 307 </p> 308 </td> 309<td> 310 <p> 311 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">list_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 312 </p> 313 </td> 314</tr> 315<tr> 316<td> 317 <p> 318 <code class="computeroutput"><span class="identifier">vector_of</span></code> 319 </p> 320 </td> 321<td> 322 <p> 323 <code class="computeroutput"><span class="identifier">vector_of_relation</span></code> 324 </p> 325 </td> 326<td> 327 <p> 328 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">vector_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 329 </p> 330 </td> 331</tr> 332<tr> 333<td> 334 <p> 335 <code class="computeroutput"><span class="identifier">unconstrained_set_of</span></code> 336 </p> 337 </td> 338<td> 339 <p> 340 <code class="computeroutput"><span class="identifier">unconstrained_set_of_relation</span></code> 341 </p> 342 </td> 343<td> 344 <p> 345 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">unconstrained_set_of</span><span class="special">.</span><span class="identifier">hpp</span></code> 346 </p> 347 </td> 348</tr> 349<tr> 350<td> 351 </td> 352<td> 353 <p> 354 <code class="computeroutput"><span class="identifier">left_based</span></code> 355 </p> 356 </td> 357<td> 358 <p> 359 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">.</span><span class="identifier">hpp</span></code> 360 </p> 361 </td> 362</tr> 363<tr> 364<td> 365 </td> 366<td> 367 <p> 368 <code class="computeroutput"><span class="identifier">right_based</span></code> 369 </p> 370 </td> 371<td> 372 <p> 373 <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">/</span><span class="identifier">bimap</span><span class="special">.</span><span class="identifier">hpp</span></code> 374 </p> 375 </td> 376</tr> 377</tbody> 378</table></div> 379</div> 380<div class="section"> 381<div class="titlepage"><div><div><h4 class="title"> 382<a name="boost_bimap.reference.bimap_reference.tags"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.tags" title="Tags">Tags</a> 383</h4></div></div></div> 384<p> 385 Tags are just conventional types used as mnemonics for the types stored 386 in a <code class="computeroutput"><span class="identifier">bimap</span></code>. Boost.Bimap 387 uses the tagged idiom to let the user specify this tags. 388 </p> 389</div> 390<div class="section"> 391<div class="titlepage"><div><div><h4 class="title"> 392<a name="boost_bimap.reference.bimap_reference.header__boost_bimap_bimap_hpp__synopsis"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.header__boost_bimap_bimap_hpp__synopsis" title='Header "boost/bimap/bimap.hpp" synopsis'>Header 393 "boost/bimap/bimap.hpp" synopsis</a> 394</h4></div></div></div> 395<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> 396<span class="keyword">namespace</span> <span class="identifier">bimaps</span> <span class="special">{</span> 397 398<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Tag</span> <span class="special">></span> 399<span class="keyword">struct</span> <span class="identifier">tagged</span><span class="special">;</span> 400 401<span class="comment">// bimap template class</span> 402 403<span class="keyword">template</span> 404<span class="special"><</span> 405 <span class="keyword">class</span> <span class="identifier">LeftCollectionType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">RightCollectionType</span><span class="special">,</span> 406 407 <span class="keyword">class</span> <span class="identifier">AdditionalParameter_1</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">not_specified</span><span class="special">,</span> 408 <span class="keyword">class</span> <span class="identifier">AdditionalParameter_2</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">not_specified</span> 409<span class="special">></span> 410<span class="keyword">class</span> <span class="identifier">bimap</span> <span class="emphasis"><em>- implementation defined { : public SetView } -</em></span> 411<span class="special">{</span> 412 <span class="keyword">public</span><span class="special">:</span> 413 414 <span class="comment">// Metadata</span> 415 416 <span class="keyword">typedef</span> <span class="emphasis"><em>-unspecified-</em></span> <span class="identifier">left_tag</span><span class="special">;</span> 417 <span class="keyword">typedef</span> <span class="emphasis"><em>-unspecified-</em></span> <span class="identifier">left_map</span><span class="special">;</span> 418 419 <span class="keyword">typedef</span> <span class="emphasis"><em>-unspecified-</em></span> <span class="identifier">right_tag</span><span class="special">;</span> 420 <span class="keyword">typedef</span> <span class="emphasis"><em>-unspecified-</em></span> <span class="identifier">right_map</span><span class="special">;</span> 421 422 <span class="comment">// Shortcuts</span> 423 <span class="comment">// typedef -side-_map::-type- -side-_-type-;</span> 424 425 <span class="keyword">typedef</span> <span class="emphasis"><em>-unspecified-</em></span> <span class="identifier">info_type</span><span class="special">;</span> 426 427 <span class="comment">// Map views</span> 428 429 <span class="identifier">left_map</span> <span class="identifier">left</span><span class="special">;</span> 430 <span class="identifier">right_map</span> <span class="identifier">right</span><span class="special">;</span> 431 432 <span class="comment">// Constructors</span> 433 434 <span class="identifier">bimap</span><span class="special">();</span> 435 436 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">InputIterator</span> <span class="special">></span> 437 <span class="identifier">bimap</span><span class="special">(</span><span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span><span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">);</span> 438 439 <span class="identifier">bimap</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bimap</span> <span class="special">&);</span> 440 441 <span class="identifier">bimap</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">bimap</span><span class="special">&</span> <span class="identifier">b</span><span class="special">);</span> 442 443 <span class="comment">// Projection of iterators</span> 444 445 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 446 <span class="identifier">left_iterator</span> <span class="identifier">project_left</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 447 448 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 449 <span class="identifier">left_const_iterator</span> <span class="identifier">project_left</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 450 451 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 452 <span class="identifier">right_iterator</span> <span class="identifier">project_right</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 453 454 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 455 <span class="identifier">right_const_iterator</span> <span class="identifier">project_right</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 456 457 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 458 <span class="identifier">iterator</span> <span class="identifier">project_up</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 459 460 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 461 <span class="identifier">const_iterator</span> <span class="identifier">project_up</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 462 463 <span class="comment">// Support for tags</span> 464 465 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 466 <span class="keyword">struct</span> <span class="identifier">map_by</span><span class="special">;</span> 467 468 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 469 <span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">by</span><span class="special">();</span> 470 471 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 472 <span class="keyword">const</span> <span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span> <span class="special">&</span> <span class="identifier">by</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 473 474 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 475 <span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">project</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 476 477 <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 478 <span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">project</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span> 479 480<span class="special">};</span> 481 482 483<span class="special">}</span> <span class="comment">// namespace bimap</span> 484<span class="special">}</span> <span class="comment">// namespace boost</span> 485</pre> 486</div> 487<div class="section"> 488<div class="titlepage"><div><div><h4 class="title"> 489<a name="boost_bimap.reference.bimap_reference.class_template_bimap"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap" title="Class template bimap">Class 490 template bimap</a> 491</h4></div></div></div> 492<div class="toc"><dl class="toc"> 493<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.complexity">Complexity</a></span></dt> 494<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.instantiation_types">Instantiation 495 types</a></span></dt> 496<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.nested_types">Nested 497 types</a></span></dt> 498<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.constructors__copy_and_assignment">Constructors, 499 copy and assignment</a></span></dt> 500<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.projection_operations">Projection 501 operations</a></span></dt> 502<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.support_for_user_defined_names">Support 503 for user defined names</a></span></dt> 504<dt><span class="section"><a href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.serialization">Serialization</a></span></dt> 505</dl></div> 506<p> 507 This is the main component of Boost.Bimap. 508 </p> 509<div class="section"> 510<div class="titlepage"><div><div><h5 class="title"> 511<a name="boost_bimap.reference.bimap_reference.class_template_bimap.complexity"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.complexity" title="Complexity">Complexity</a> 512</h5></div></div></div> 513<p> 514 In the descriptions of the operations of <code class="computeroutput"><span class="identifier">bimap</span></code>, 515 we adopt the scheme outlined in the complexity signature section. 516 </p> 517</div> 518<div class="section"> 519<div class="titlepage"><div><div><h5 class="title"> 520<a name="boost_bimap.reference.bimap_reference.class_template_bimap.instantiation_types"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.instantiation_types" title="Instantiation types">Instantiation 521 types</a> 522</h5></div></div></div> 523<p> 524 <code class="computeroutput"><span class="identifier">bimap</span></code> is instantiated 525 with the following types: 526 </p> 527<div class="orderedlist"><ol class="orderedlist" type="1"> 528<li class="listitem"> 529 LeftCollectionType and RightCollectionType are collection type specifications 530 optionally tagged, or any type optionally tagged, in which case that 531 side acts as a set. 532 </li> 533<li class="listitem"> 534 AdditionalParameter_{1/2} can be any ordered subset of: 535 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 536<li class="listitem"> 537 CollectionTypeOfRelation specification 538 </li> 539<li class="listitem"> 540 Allocator 541 </li> 542</ul></div> 543 </li> 544</ol></div> 545</div> 546<div class="section"> 547<div class="titlepage"><div><div><h5 class="title"> 548<a name="boost_bimap.reference.bimap_reference.class_template_bimap.nested_types"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.nested_types" title="Nested types">Nested 549 types</a> 550</h5></div></div></div> 551<pre class="programlisting"><span class="identifier">left_tag</span><span class="special">,</span> <span class="identifier">right_tag</span> 552</pre> 553<div class="blockquote"><blockquote class="blockquote"><p> 554 Tags for each side of the bimap. If the user has not specified any 555 tag the tags default to <code class="computeroutput"><span class="identifier">member_at</span><span class="special">::</span><span class="identifier">left</span></code> 556 and <code class="computeroutput"><span class="identifier">member_at</span><span class="special">::</span><span class="identifier">right</span></code>. 557 </p></blockquote></div> 558<pre class="programlisting"><span class="identifier">left_key_type</span><span class="special">,</span> <span class="identifier">right_key_type</span> 559</pre> 560<div class="blockquote"><blockquote class="blockquote"><p> 561 Key type of each side. In a <code class="computeroutput"><span class="identifier">bimap</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">></span> </code> <code class="computeroutput"><span class="identifier">left_key_type</span></code> 562 is <code class="computeroutput"><span class="identifier">A</span></code> and <code class="computeroutput"><span class="identifier">right_key_type</span></code> is <code class="computeroutput"><span class="identifier">B</span></code>. 563 If there are tags, it is better to use: <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">key_type</span></code>. 564 </p></blockquote></div> 565<pre class="programlisting"><span class="identifier">left_data_type</span><span class="special">,</span> <span class="identifier">right_data_type</span> 566</pre> 567<div class="blockquote"><blockquote class="blockquote"><p> 568 Data type of each side. In a bimap<A,B> left_key_type is B and 569 right_key_type is A. If there are tags, it is better to use: <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">data_type</span></code>. 570 </p></blockquote></div> 571<pre class="programlisting"><span class="identifier">left_value_type</span><span class="special">,</span> <span class="identifier">right_value_type</span> 572</pre> 573<div class="blockquote"><blockquote class="blockquote"><p> 574 Value type used for the views. If there are tags, it is better to use: 575 <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">value_type</span></code>. 576 </p></blockquote></div> 577<pre class="programlisting"><span class="identifier">left_iterator</span><span class="special">,</span> <span class="identifier">right_iterator</span> 578<span class="identifier">left_const_iterator</span><span class="special">,</span> <span class="identifier">right_const_iterator</span> 579</pre> 580<div class="blockquote"><blockquote class="blockquote"><p> 581 Iterators of the views. If there are tags, it is better to use: <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">iterator</span></code> and <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">const_iterator</span></code> 582 </p></blockquote></div> 583<pre class="programlisting"><span class="identifier">left_map</span><span class="special">,</span> <span class="identifier">right_map</span> 584</pre> 585<div class="blockquote"><blockquote class="blockquote"><p> 586 Map view type of each side. If there are tags, it is better to use: 587 <code class="computeroutput"><span class="identifier">Bimap</span><span class="special">::</span><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span></code>. 588 </p></blockquote></div> 589</div> 590<div class="section"> 591<div class="titlepage"><div><div><h5 class="title"> 592<a name="boost_bimap.reference.bimap_reference.class_template_bimap.constructors__copy_and_assignment"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.constructors__copy_and_assignment" title="Constructors, copy and assignment">Constructors, 593 copy and assignment</a> 594</h5></div></div></div> 595<pre class="programlisting"><span class="identifier">bimap</span><span class="special">();</span> 596</pre> 597<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 598<li class="listitem"> 599 <span class="bold"><strong>Effects:</strong></span> Constructs an empty <code class="computeroutput"><span class="identifier">bimap</span></code>. 600 </li> 601<li class="listitem"> 602 <span class="bold"><strong>Complexity:</strong></span> Constant. 603 </li> 604</ul></div> 605<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">></span> 606<span class="identifier">bimap</span><span class="special">(</span><span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span><span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">);</span> 607</pre> 608<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 609<li class="listitem"> 610 <span class="bold"><strong>Requires: </strong></span> <code class="computeroutput"><span class="identifier">InputIterator</span></code> 611 is a model of Input Iterator over elements of type <code class="computeroutput"><span class="identifier">relation</span></code> or a type convertible 612 to <code class="computeroutput"><span class="identifier">relation</span></code>. last 613 is reachable from <code class="computeroutput"><span class="identifier">first</span></code>. 614 </li> 615<li class="listitem"> 616 <span class="bold"><strong>Effects:</strong></span> Constructs an empty <code class="computeroutput"><span class="identifier">bimap</span></code> and fills it with the elements 617 in the range <code class="computeroutput"><span class="special">[</span><span class="identifier">first</span><span class="special">,</span><span class="identifier">last</span><span class="special">)</span></code>. Insertion of each element may or 618 may not succeed depending on acceptance by the collection types of 619 the <code class="computeroutput"><span class="identifier">bimap</span></code>. 620 </li> 621<li class="listitem"> 622 <a class="link" href="bimap_reference.html#complexity_signature_explanation"><span class="bold"><strong>Complexity:</strong></span></a> 623 O(m*H(m)), where m is the number of elements in <code class="computeroutput"><span class="special">[</span><span class="identifier">first</span><span class="special">,</span><span class="identifier">last</span><span class="special">)</span></code>. 624 </li> 625</ul></div> 626<pre class="programlisting"><span class="identifier">bimap</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">bimap</span> <span class="special">&</span> <span class="identifier">x</span><span class="special">);</span> 627</pre> 628<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 629<li class="listitem"> 630 <span class="bold"><strong>Effects:</strong></span> Constructs a copy of x, 631 copying its elements as well as its internal objects (key extractors, 632 comparison objects, allocator.) 633 </li> 634<li class="listitem"> 635 <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">==</span> 636 <span class="identifier">x</span></code>. The order of the views 637 of the <code class="computeroutput"><span class="identifier">bimap</span></code> is preserved 638 as well. 639 </li> 640<li class="listitem"> 641 <span class="bold"><strong>Complexity:</strong></span> O(x.size()*log(x.size()) 642 + C(x.size())) 643 </li> 644</ul></div> 645<pre class="programlisting"><span class="special">~</span><span class="identifier">bimap</span><span class="special">()</span> 646</pre> 647<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 648<li class="listitem"> 649 <span class="bold"><strong>Effects:</strong></span> Destroys the <code class="computeroutput"><span class="identifier">bimap</span></code> and all the elements contained. 650 The order in which the elements are destroyed is not specified. 651 </li> 652<li class="listitem"> 653 <span class="bold"><strong>Complexity:</strong></span> O(n). 654 </li> 655</ul></div> 656<pre class="programlisting"><span class="identifier">bimap</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">bimap</span><span class="special">&</span> <span class="identifier">x</span><span class="special">);</span> 657</pre> 658<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 659<li class="listitem"> 660 <span class="bold"><strong>Effects:</strong></span> Replaces the elements and 661 internal objects of the <code class="computeroutput"><span class="identifier">bimap</span></code> 662 with copies from x. 663 </li> 664<li class="listitem"> 665 <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span><span class="special">==</span><span class="identifier">x</span></code>. The order on the views of the 666 <code class="computeroutput"><span class="identifier">bimap</span></code> is preserved 667 as well. 668 </li> 669<li class="listitem"> 670 <span class="bold"><strong>Returns: </strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. 671 </li> 672<li class="listitem"> 673 <span class="bold"><strong>Complexity:</strong></span> O(n + x.size()*log(x.size()) 674 + C(x.size())). 675 </li> 676<li class="listitem"> 677 <span class="bold"><strong>Exception safety:</strong></span> Strong, provided 678 the copy and assignment operations of the types of <code class="computeroutput"><span class="identifier">ctor_args_list</span></code> do not throw. 679 </li> 680</ul></div> 681</div> 682<div class="section"> 683<div class="titlepage"><div><div><h5 class="title"> 684<a name="boost_bimap.reference.bimap_reference.class_template_bimap.projection_operations"></a><a name="reference_projection_operations"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.projection_operations" title="Projection operations">Projection 685 operations</a> 686</h5></div></div></div> 687<p> 688 Given a <code class="computeroutput"><span class="identifier">bimap</span></code> with views 689 v1 and v2, we say than an v1-iterator it1 and an v2-iterator it2 are 690 equivalent if: 691 </p> 692<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 693<li class="listitem"> 694 <code class="computeroutput"><span class="identifier">it1</span> <span class="special">==</span> 695 <span class="identifier">i1</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span></code> 696 AND <code class="computeroutput"><span class="identifier">it2</span> <span class="special">==</span> 697 <span class="identifier">i2</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span></code>, 698 </li> 699<li class="listitem"> 700 OR <code class="computeroutput"><span class="identifier">it1</span></code> and <code class="computeroutput"><span class="identifier">it2</span></code> point to the same element. 701 </li> 702</ul></div> 703<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 704<span class="identifier">left_iterator</span> <span class="identifier">project_left</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 705 706<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 707<span class="identifier">left_const_iterator</span> <span class="identifier">project_left</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 708</pre> 709<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 710<li class="listitem"> 711 <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">IteratorType</span></code> 712 is a bimap view iterator. it is a valid iterator of some view of 713 <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> 714 (i.e. does not refer to some other <code class="computeroutput"><span class="identifier">bimap</span></code>.) 715 </li> 716<li class="listitem"> 717 <span class="bold"><strong>Effects:</strong></span> Returns a left map view 718 iterator equivalent to <code class="computeroutput"><span class="identifier">it</span></code>. 719 </li> 720<li class="listitem"> 721 <span class="bold"><strong>Complexity:</strong></span> Constant. 722 </li> 723<li class="listitem"> 724 <span class="bold"><strong>Exception safety:</strong></span> nothrow. 725 </li> 726</ul></div> 727<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 728<span class="identifier">right_iterator</span> <span class="identifier">project_right</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 729 730<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 731<span class="identifier">right_const_iterator</span> <span class="identifier">project_right</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 732</pre> 733<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 734<li class="listitem"> 735 <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">IteratorType</span></code> 736 is a bimap view iterator. it is a valid iterator of some view of 737 <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> 738 (i.e. does not refer to some other <code class="computeroutput"><span class="identifier">bimap</span></code>.) 739 </li> 740<li class="listitem"> 741 <span class="bold"><strong>Effects:</strong></span> Returns a right map view 742 iterator equivalent to <code class="computeroutput"><span class="identifier">it</span></code>. 743 </li> 744<li class="listitem"> 745 <span class="bold"><strong>Complexity:</strong></span> Constant. 746 </li> 747<li class="listitem"> 748 <span class="bold"><strong>Exception safety:</strong></span> nothrow. 749 </li> 750</ul></div> 751<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 752<span class="identifier">iterator</span> <span class="identifier">project_up</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 753 754<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 755<span class="identifier">const_iterator</span> <span class="identifier">project_up</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 756</pre> 757<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 758<li class="listitem"> 759 <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">IteratorType</span></code> 760 is a bimap view iterator. it is a valid iterator of some view of 761 <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> 762 (i.e. does not refer to some other <code class="computeroutput"><span class="identifier">bimap</span></code>.) 763 </li> 764<li class="listitem"> 765 <span class="bold"><strong>Effects:</strong></span> Returns a collection of 766 relations view iterator equivalent to <code class="computeroutput"><span class="identifier">it</span></code>. 767 </li> 768<li class="listitem"> 769 <span class="bold"><strong>Complexity:</strong></span> Constant. 770 </li> 771<li class="listitem"> 772 <span class="bold"><strong>Exception safety:</strong></span> nothrow. 773 </li> 774</ul></div> 775</div> 776<div class="section"> 777<div class="titlepage"><div><div><h5 class="title"> 778<a name="boost_bimap.reference.bimap_reference.class_template_bimap.support_for_user_defined_names"></a><a name="reference_support_for_used_defined_names"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.support_for_user_defined_names" title="Support for user defined names">Support 779 for user defined names</a> 780</h5></div></div></div> 781<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 782<span class="keyword">struct</span> <span class="identifier">map_by</span><span class="special">;</span> 783</pre> 784<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 785<li class="listitem"> 786 <code class="computeroutput"><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span></code> yields the type of the map 787 view tagged with <code class="computeroutput"><span class="identifier">Tag</span></code>. 788 <code class="computeroutput"><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span></code><span class="emphasis"><em>-type 789 name-</em></span> is the same as <code class="computeroutput"><span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span><span class="special">::</span></code><span class="emphasis"><em>-type name-</em></span>. 790 </li> 791<li class="listitem"> 792 <span class="bold"><strong>Requires: </strong></span> <code class="computeroutput"><span class="identifier">Tag</span></code> 793 is a valid user defined name of the bimap. 794 </li> 795</ul></div> 796<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 797<span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">by</span><span class="special">();</span> 798 799<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span> <span class="special">></span> 800<span class="keyword">const</span> <span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">type</span> <span class="special">&</span> <span class="identifier">by</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 801</pre> 802<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 803<li class="listitem"> 804 <span class="bold"><strong>Requires: </strong></span> <code class="computeroutput"><span class="identifier">Tag</span></code> 805 is a valid user defined name of the bimap. 806 </li> 807<li class="listitem"> 808 <span class="bold"><strong>Effects:</strong></span> Returns a reference to 809 the map view tagged with <code class="computeroutput"><span class="identifier">Tag</span></code> 810 held by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. 811 </li> 812<li class="listitem"> 813 <span class="bold"><strong>Complexity:</strong></span> Constant. 814 </li> 815<li class="listitem"> 816 <span class="bold"><strong>Exception safety:</strong></span> nothrow. 817 </li> 818</ul></div> 819<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 820<span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">project</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">);</span> 821 822<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Tag</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">IteratorType</span> <span class="special">></span> 823<span class="identifier">map_by</span><span class="special"><</span><span class="identifier">Tag</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">project</span><span class="special">(</span><span class="identifier">IteratorType</span> <span class="identifier">iter</span><span class="special">)</span> <span class="keyword">const</span> 824</pre> 825<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 826<li class="listitem"> 827 <span class="bold"><strong>Requires: </strong></span> <code class="computeroutput"><span class="identifier">Tag</span></code> 828 is a valid user defined name of the bimap. <code class="computeroutput"><span class="identifier">IteratorType</span></code> 829 is a bimap view iterator. it is a valid iterator of some view of 830 <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> 831 (i.e. does not refer to some other <code class="computeroutput"><span class="identifier">bimap</span></code>.) 832 </li> 833<li class="listitem"> 834 <span class="bold"><strong>Effects:</strong></span> Returns a reference to 835 the map view tagged with <code class="computeroutput"><span class="identifier">Tag</span></code> 836 held by <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. 837 </li> 838<li class="listitem"> 839 <span class="bold"><strong>Complexity:</strong></span> Constant. 840 </li> 841<li class="listitem"> 842 <span class="bold"><strong>Exception safety:</strong></span> nothrow. 843 </li> 844</ul></div> 845</div> 846<div class="section"> 847<div class="titlepage"><div><div><h5 class="title"> 848<a name="boost_bimap.reference.bimap_reference.class_template_bimap.serialization"></a><a class="link" href="bimap_reference.html#boost_bimap.reference.bimap_reference.class_template_bimap.serialization" title="Serialization">Serialization</a> 849</h5></div></div></div> 850<p> 851 A <code class="computeroutput"><span class="identifier">bimap</span></code> can be archived 852 and retrieved by means of <a href="http://www.boost.org/libs/serialization/doc/index.html" target="_top"><span class="bold"><strong>Boost.Serialization</strong></span></a>. Boost.Bimap does 853 not expose a public serialisation interface, as this is provided by Boost.Serialization 854 itself. Both regular and XML archives are supported. 855 </p> 856<p> 857 Each of the set specifications comprising a given <code class="computeroutput"><span class="identifier">bimap</span></code> 858 contributes its own preconditions as well as guarantees on the retrieved 859 containers. In describing these, the following concepts are used. A type 860 <code class="computeroutput"><span class="identifier">T</span></code> is <span class="emphasis"><em>serializable</em></span> 861 (resp. XML-serializable) if any object of type <code class="computeroutput"><span class="identifier">T</span></code> 862 can be saved to an output archive (XML archive) and later retrieved from 863 an input archive (XML archive) associated to the same storage. If <code class="computeroutput"><span class="identifier">x</span></code>' of type <code class="computeroutput"><span class="identifier">T</span></code> 864 is loaded from the serialization information saved from another object 865 x, we say that x' is a <span class="emphasis"><em>restored copy</em></span> of x. Given 866 a <a href="https://www.boost.org/sgi/stl/BinaryPredicate.html" target="_top">Binary 867 Predicate</a> <code class="computeroutput"><span class="identifier">Pred</span></code> 868 over <code class="computeroutput"><span class="special">(</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">)</span></code>, and objects <code class="computeroutput"><span class="identifier">p</span></code> 869 and <code class="computeroutput"><span class="identifier">q</span></code> of type <code class="computeroutput"><span class="identifier">Pred</span></code>, we say that <code class="computeroutput"><span class="identifier">q</span></code> 870 is <span class="emphasis"><em>serialization-compatible</em></span> with <code class="computeroutput"><span class="identifier">p</span></code> 871 if 872 </p> 873<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 874 <code class="computeroutput"><span class="identifier">p</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span><span class="identifier">y</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">q</span><span class="special">(</span><span class="identifier">x</span></code>'<code class="computeroutput"><span class="special">,</span><span class="identifier">y</span></code>'<code class="computeroutput"><span class="special">)</span></code> 875 </li></ul></div> 876<p> 877 for every <code class="computeroutput"><span class="identifier">x</span></code> and <code class="computeroutput"><span class="identifier">y</span></code> of type <code class="computeroutput"><span class="identifier">T</span></code> 878 and <code class="computeroutput"><span class="identifier">x</span></code>' and <code class="computeroutput"><span class="identifier">y</span></code>' being restored copies of <code class="computeroutput"><span class="identifier">x</span></code> and <code class="computeroutput"><span class="identifier">y</span></code>, 879 respectively. 880 </p> 881<div class="blurb"> 882<div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div> 883<p> 884 <span class="bold"><strong>Operation:</strong></span> saving of a <code class="computeroutput"><span class="identifier">bimap</span> <span class="identifier">b</span></code> 885 to an output archive (XML archive) ar. 886 </p> 887</div> 888<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 889<li class="listitem"> 890 <span class="bold"><strong>Requires:</strong></span> Value is serializable 891 (XML-serializable). Additionally, each of the views of b can impose 892 other requirements. 893 </li> 894<li class="listitem"> 895 <span class="bold"><strong>Exception safety:</strong></span> Strong with respect 896 to <code class="computeroutput"><span class="identifier">b</span></code>. If an exception 897 is thrown, ar may be left in an inconsistent state. 898 </li> 899</ul></div> 900<div class="blurb"> 901<div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div> 902<p> 903 <span class="bold"><strong>Operation:</strong></span> loading of a <code class="computeroutput"><span class="identifier">bimap</span></code> m' from an input archive (XML 904 archive) ar. 905 </p> 906</div> 907<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 908<li class="listitem"> 909 <span class="bold"><strong>Requires:</strong></span> Value is serializable 910 (XML-serializable). Additionally, each of the views of <code class="computeroutput"><span class="identifier">b</span></code>' can impose other requirements. 911 </li> 912<li class="listitem"> 913 <span class="bold"><strong>Exception safety:</strong></span> Basic. If an exception 914 is thrown, ar may be left in an inconsistent state. 915 </li> 916</ul></div> 917</div> 918</div> 919</div> 920<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 921<td align="left"></td> 922<td align="right"><div class="copyright-footer">Copyright © 2006-2012 Matias Capeletto<p> 923 Distributed under the Boost Software License, Version 1.0. (See accompanying 924 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 925 </p> 926</div></td> 927</tr></table> 928<hr> 929<div class="spirit-nav"> 930<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_of_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 931</div> 932</body> 933</html> 934