1<!-- 2Copyright Daniel James 2006-2009 3Distributed under the Boost Software License, Version 1.0. (See accompanying 4file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5--><library-reference> 6 <header name="boost/unordered_set.hpp"> 7 <namespace name="boost"> 8 <class name="unordered_set"> 9 <template> 10 <template-type-parameter name="Value"> 11 </template-type-parameter> 12 <template-type-parameter name="Hash"> 13 <default><type>boost::hash<Value></type></default> 14 </template-type-parameter> 15 <template-type-parameter name="Pred"> 16 <default><type>std::equal_to<Value></type></default> 17 </template-type-parameter> 18 <template-type-parameter name="Alloc"> 19 <default><type>std::allocator<Value></type></default> 20 </template-type-parameter> 21 </template> 22 <purpose><simpara> 23 An unordered associative container that stores unique values. 24 </simpara></purpose> 25 <description> 26 <para><emphasis role="bold">Template Parameters</emphasis> 27 <informaltable> 28 <tgroup cols="2"> 29 <tbody> 30 <row> 31 <entry><emphasis>Value</emphasis></entry> 32 <entry><code>Value</code> must be <code>Erasable</code> from the container 33 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 34 </entry></row> 35 <row> 36 <entry><emphasis>Hash</emphasis></entry> 37 <entry>A unary function object type that acts a hash function for a <code>Value</code>. It takes a single argument of type <code>Value</code> and returns a value of type std::size_t.</entry></row> 38 <row> 39 <entry><emphasis>Pred</emphasis></entry> 40 <entry>A binary function object that implements an equivalence relation on values of type <code>Value</code>. 41 A binary function object that induces an equivalence relation on values of type <code>Value</code>. 42 It takes two arguments of type <code>Value</code> and returns a value of type bool.</entry></row> 43 <row> 44 <entry><emphasis>Alloc</emphasis></entry> 45 <entry>An allocator whose value type is the same as the container's value type.</entry></row></tbody></tgroup></informaltable></para> 46 <para>The elements are organized into buckets. Keys with the same hash code are stored in the same bucket.</para> 47 <para>The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.</para> 48 </description> 49 <typedef name="key_type"> 50 <type>Value</type> 51 </typedef> 52 <typedef name="value_type"> 53 <type>Value</type> 54 </typedef> 55 <typedef name="hasher"> 56 <type>Hash</type> 57 </typedef> 58 <typedef name="key_equal"> 59 <type>Pred</type> 60 </typedef> 61 <typedef name="allocator_type"> 62 <type>Alloc</type> 63 </typedef> 64 <typedef name="pointer"> 65 <type>typename allocator_type::pointer</type> 66 <description> 67 <para> 68 <code>value_type*</code> if 69 <code>allocator_type::pointer</code> is not defined. 70 </para> 71 </description> 72 </typedef> 73 <typedef name="const_pointer"> 74 <type>typename allocator_type::const_pointer</type> 75 <description> 76 <para> 77 <code>boost::pointer_to_other<pointer, value_type>::type</code> 78 if <code>allocator_type::const_pointer</code> is not defined. 79 </para> 80 </description> 81 </typedef> 82 <typedef name="reference"> 83 <type>value_type&</type> 84 <purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose> 85 </typedef> 86 <typedef name="const_reference"> 87 <type>value_type const&</type> 88 <purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose> 89 </typedef> 90 <typedef name="size_type"> 91 <type><emphasis>implementation-defined</emphasis></type> 92 <description> 93 <para>An unsigned integral type.</para> 94 <para><type>size_type</type> can represent any non-negative value of <type>difference_type</type>.</para> 95 </description> 96 </typedef> 97 <typedef name="difference_type"> 98 <type><emphasis>implementation-defined</emphasis></type> 99 <description> 100 <para>A signed integral type.</para> 101 <para>Is identical to the difference type of <type>iterator</type> and <type>const_iterator</type>.</para> 102 </description> 103 </typedef> 104 <typedef name="iterator"> 105 <type><emphasis>implementation-defined</emphasis></type> 106 <description> 107 <para>A constant iterator whose value type is <type>value_type</type>. </para> 108 <para>The iterator category is at least a forward iterator.</para> 109 <para>Convertible to <type>const_iterator</type>.</para> 110 </description> 111 </typedef> 112 <typedef name="const_iterator"> 113 <type><emphasis>implementation-defined</emphasis></type> 114 <description> 115 <para>A constant iterator whose value type is <type>value_type</type>. </para> 116 <para>The iterator category is at least a forward iterator.</para> 117 </description> 118 </typedef> 119 <typedef name="local_iterator"> 120 <type><emphasis>implementation-defined</emphasis></type> 121 <description> 122 <para>An iterator with the same value type, difference type and pointer and reference type as <type>iterator</type>.</para> 123 <para>A local_iterator object can be used to iterate through a single bucket.</para> 124 </description> 125 </typedef> 126 <typedef name="const_local_iterator"> 127 <type><emphasis>implementation-defined</emphasis></type> 128 <description> 129 <para>A constant iterator with the same value type, difference type and pointer and reference type as <type>const_iterator</type>.</para> 130 <para>A const_local_iterator object can be used to iterate through a single bucket.</para> 131 </description> 132 </typedef> 133 <typedef name="node_type"> 134 <type><emphasis>implementation-defined</emphasis></type> 135 <description> 136 <para>See <classname>node_handle_set</classname> for details.</para> 137 </description> 138 </typedef> 139 <typedef name="insert_return_type"> 140 <type><emphasis>implementation-defined</emphasis></type> 141 <description> 142 Structure returned by inserting <code>node_type</code>. 143 </description> 144 </typedef> 145 <constructor> 146 <postconditions> 147 <code><methodname>size</methodname>() == 0</code> 148 </postconditions> 149 <description> 150 <para>Constructs an empty container using hasher() as the hash function, key_equal() as the key equality predicate, allocator_type() as the allocator and a maximum load factor of 1.0.</para> 151 </description> 152 <requires> 153 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 154 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 155 </para> 156 </requires> 157 </constructor> 158 <constructor specifiers="explicit"> 159 <parameter name="n"> 160 <paramtype>size_type</paramtype> 161 </parameter> 162 <parameter name="hf"> 163 <paramtype>hasher const&</paramtype> 164 <default>hasher()</default> 165 </parameter> 166 <parameter name="eq"> 167 <paramtype>key_equal const&</paramtype> 168 <default>key_equal()</default> 169 </parameter> 170 <parameter name="a"> 171 <paramtype>allocator_type const&</paramtype> 172 <default>allocator_type()</default> 173 </parameter> 174 <postconditions> 175 <code><methodname>size</methodname>() == 0</code> 176 </postconditions> 177 <description> 178 <para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para> 179 </description> 180 <requires> 181 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 182 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 183 </para> 184 </requires> 185 </constructor> 186 <constructor> 187 <template> 188 <template-type-parameter name="InputIterator"> 189 </template-type-parameter> 190 </template> 191 <parameter name="f"> 192 <paramtype>InputIterator</paramtype> 193 </parameter> 194 <parameter name="l"> 195 <paramtype>InputIterator</paramtype> 196 </parameter> 197 <parameter name="n"> 198 <paramtype>size_type</paramtype> 199 <default><emphasis>implementation-defined</emphasis></default> 200 </parameter> 201 <parameter name="hf"> 202 <paramtype>hasher const&</paramtype> 203 <default>hasher()</default> 204 </parameter> 205 <parameter name="eq"> 206 <paramtype>key_equal const&</paramtype> 207 <default>key_equal()</default> 208 </parameter> 209 <parameter name="a"> 210 <paramtype>allocator_type const&</paramtype> 211 <default>allocator_type()</default> 212 </parameter> 213 <description> 214 <para>Constructs an empty container with at least <code>n</code> buckets, 215 using <code>hf</code> as the hash function, 216 <code>eq</code> as the key equality predicate, 217 <code>a</code> as the allocator and a maximum load factor of 1.0 218 and inserts the elements from [f, l) into it. 219 </para> 220 </description> 221 <requires> 222 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 223 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 224 </para> 225 </requires> 226 </constructor> 227 <constructor> 228 <parameter> 229 <paramtype>unordered_set const&</paramtype> 230 </parameter> 231 <description> 232 <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para> 233 <para>If <code>Allocator::select_on_container_copy_construction</code> 234 exists and has the right signature, the allocator will be 235 constructed from its result.</para> 236 </description> 237 <requires> 238 <para><code>value_type</code> is copy constructible</para> 239 </requires> 240 </constructor> 241 <constructor> 242 <parameter> 243 <paramtype>unordered_set &&</paramtype> 244 </parameter> 245 <description> 246 <para>The move constructor.</para> 247 </description> 248 <notes> 249 <para>This is implemented using Boost.Move.</para> 250 </notes> 251 <requires> 252 <para> 253 <code>value_type</code> is move constructible. 254 </para> 255 <para> 256 On compilers without rvalue reference support the 257 emulation does not support moving without calling 258 <code>boost::move</code> if <code>value_type</code> is 259 not copyable. So, for example, you can't return the 260 container from a function. 261 </para> 262 </requires> 263 </constructor> 264 <constructor specifiers="explicit"> 265 <parameter name="a"> 266 <paramtype>Allocator const&</paramtype> 267 </parameter> 268 <description> 269 <para>Constructs an empty container, using allocator <code>a</code>.</para> 270 </description> 271 </constructor> 272 <constructor> 273 <parameter name="x"> 274 <paramtype>unordered_set const&</paramtype> 275 </parameter> 276 <parameter name="a"> 277 <paramtype>Allocator const&</paramtype> 278 </parameter> 279 <description> 280 <para>Constructs an container, copying <code>x</code>'s contained elements, hash function, predicate, maximum load factor, but using allocator <code>a</code>.</para> 281 </description> 282 </constructor> 283 <constructor> 284 <parameter name="x"> 285 <paramtype>unordered_set &&</paramtype> 286 </parameter> 287 <parameter name="a"> 288 <paramtype>Allocator const&</paramtype> 289 </parameter> 290 <description> 291 <para>Construct a container moving <code>x</code>'s contained elements, and having the hash function, predicate and maximum load factor, but using allocate <code>a</code>.</para> 292 </description> 293 <notes> 294 <para>This is implemented using Boost.Move.</para> 295 </notes> 296 <requires> 297 <para> 298 <code>value_type</code> is move insertable. 299 </para> 300 </requires> 301 </constructor> 302 <constructor> 303 <parameter name="il"> 304 <paramtype>initializer_list<value_type></paramtype> 305 </parameter> 306 <parameter name="n"> 307 <paramtype>size_type</paramtype> 308 <default><emphasis>implementation-defined</emphasis></default> 309 </parameter> 310 <parameter name="hf"> 311 <paramtype>hasher const&</paramtype> 312 <default>hasher()</default> 313 </parameter> 314 <parameter name="eq"> 315 <paramtype>key_equal const&</paramtype> 316 <default>key_equal()</default> 317 </parameter> 318 <parameter name="a"> 319 <paramtype>allocator_type const&</paramtype> 320 <default>allocator_type()</default> 321 </parameter> 322 <description> 323 <para>Constructs an empty container with at least <code>n</code> buckets, 324 using <code>hf</code> as the hash function, 325 <code>eq</code> as the key equality predicate, 326 <code>a</code> as the allocator and a maximum load factor of 1.0 327 and inserts the elements from <code>il</code> into it. 328 </para> 329 </description> 330 <requires> 331 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 332 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 333 </para> 334 </requires> 335 </constructor> 336 <constructor> 337 <parameter name="n"> 338 <paramtype>size_type</paramtype> 339 </parameter> 340 <parameter name="a"> 341 <paramtype>allocator_type const&</paramtype> 342 </parameter> 343 <postconditions> 344 <code><methodname>size</methodname>() == 0</code> 345 </postconditions> 346 <description> 347 <para>Constructs an empty container with at least <code>n</code> buckets, 348 using <code>hf</code> as the hash function, 349 the default hash function and key equality predicate, 350 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 351 </description> 352 <requires> 353 <para><code>hasher</code> and <code>key_equal</code> need to be <code>DefaultConstructible</code>. 354 </para> 355 </requires> 356 </constructor> 357 <constructor> 358 <parameter name="n"> 359 <paramtype>size_type</paramtype> 360 </parameter> 361 <parameter name="hf"> 362 <paramtype>hasher const&</paramtype> 363 </parameter> 364 <parameter name="a"> 365 <paramtype>allocator_type const&</paramtype> 366 </parameter> 367 <postconditions> 368 <code><methodname>size</methodname>() == 0</code> 369 </postconditions> 370 <description> 371 <para>Constructs an empty container with at least <code>n</code> buckets, 372 using <code>hf</code> as the hash function, 373 the default key equality predicate, 374 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 375 </description> 376 <requires> 377 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 378 </para> 379 </requires> 380 </constructor> 381 <constructor> 382 <template> 383 <template-type-parameter name="InputIterator"> 384 </template-type-parameter> 385 </template> 386 <parameter name="f"> 387 <paramtype>InputIterator</paramtype> 388 </parameter> 389 <parameter name="l"> 390 <paramtype>InputIterator</paramtype> 391 </parameter> 392 <parameter name="n"> 393 <paramtype>size_type</paramtype> 394 </parameter> 395 <parameter name="a"> 396 <paramtype>allocator_type const&</paramtype> 397 </parameter> 398 <description> 399 <para>Constructs an empty container with at least <code>n</code> buckets, 400 using <code>a</code> as the allocator, with the 401 default hash function and key equality predicate 402 and a maximum load factor of 1.0 403 and inserts the elements from [f, l) into it. 404 </para> 405 </description> 406 <requires> 407 <para><code>hasher</code>, <code>key_equal</code> need to be <code>DefaultConstructible</code>. 408 </para> 409 </requires> 410 </constructor> 411 <constructor> 412 <template> 413 <template-type-parameter name="InputIterator"> 414 </template-type-parameter> 415 </template> 416 <parameter name="f"> 417 <paramtype>InputIterator</paramtype> 418 </parameter> 419 <parameter name="l"> 420 <paramtype>InputIterator</paramtype> 421 </parameter> 422 <parameter name="n"> 423 <paramtype>size_type</paramtype> 424 </parameter> 425 <parameter name="hf"> 426 <paramtype>hasher const&</paramtype> 427 </parameter> 428 <parameter name="a"> 429 <paramtype>allocator_type const&</paramtype> 430 </parameter> 431 <description> 432 <para>Constructs an empty container with at least <code>n</code> buckets, 433 using <code>hf</code> as the hash function, 434 <code>a</code> as the allocator, with the 435 default key equality predicate 436 and a maximum load factor of 1.0 437 and inserts the elements from [f, l) into it. 438 </para> 439 </description> 440 <requires> 441 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 442 </para> 443 </requires> 444 </constructor> 445 <destructor> 446 <notes> 447 <para>The destructor is applied to every element, and all memory is deallocated</para> 448 </notes> 449 </destructor> 450 <method name="operator="> 451 <parameter> 452 <paramtype>unordered_set const&</paramtype> 453 </parameter> 454 <type>unordered_set&</type> 455 <description> 456 <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para> 457 <para>If <code>Alloc::propagate_on_container_copy_assignment</code> 458 exists and <code>Alloc::propagate_on_container_copy_assignment::value 459 </code> is true, the allocator is overwritten, if not the 460 copied elements are created using the existing 461 allocator.</para> 462 </description> 463 <requires> 464 <para><code>value_type</code> is copy constructible</para> 465 </requires> 466 </method> 467 <method name="operator="> 468 <parameter> 469 <paramtype>unordered_set &&</paramtype> 470 </parameter> 471 <type>unordered_set&</type> 472 <description> 473 <para>The move assignment operator.</para> 474 <para>If <code>Alloc::propagate_on_container_move_assignment</code> 475 exists and <code>Alloc::propagate_on_container_move_assignment::value 476 </code> is true, the allocator is overwritten, if not the 477 moved elements are created using the existing 478 allocator.</para> 479 </description> 480 <notes> 481 <para> 482 On compilers without rvalue references, this is emulated using 483 Boost.Move. Note that on some compilers the copy assignment 484 operator may be used in some circumstances. 485 </para> 486 </notes> 487 <requires> 488 <para> 489 <code>value_type</code> is move constructible. 490 </para> 491 </requires> 492 </method> 493 <method name="operator="> 494 <parameter> 495 <paramtype>initializer_list<value_type></paramtype> 496 </parameter> 497 <type>unordered_set&</type> 498 <description> 499 <para>Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed.</para> 500 </description> 501 <requires> 502 <para> 503 <code>value_type</code> is <code>CopyInsertable</code> into the container and 504 <code>CopyAssignable</code>. 505 </para> 506 </requires> 507 </method> 508 <method name="get_allocator" cv="const"> 509 <type>allocator_type</type> 510 </method> 511 <method-group name="size and capacity"> 512 <method name="empty" cv="const"> 513 <type>bool</type> 514 <returns> 515 <code><methodname>size</methodname>() == 0</code> 516 </returns> 517 </method> 518 <method name="size" cv="const"> 519 <type>size_type</type> 520 <returns> 521 <code>std::distance(<methodname>begin</methodname>(), <methodname>end</methodname>())</code> 522 </returns> 523 </method> 524 <method name="max_size" cv="const"> 525 <type>size_type</type> 526 <returns><code><methodname>size</methodname>()</code> of the largest possible container. 527 </returns> 528 </method> 529 </method-group> 530 <method-group name="iterators"> 531 <overloaded-method name="begin"> 532 <signature><type>iterator</type></signature> 533 <signature cv="const"><type>const_iterator</type></signature> 534 <returns>An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 535 </returns> 536 </overloaded-method> 537 <overloaded-method name="end"> 538 <signature> 539 <type>iterator</type> 540 </signature> 541 <signature cv="const"> 542 <type>const_iterator</type> 543 </signature> 544 <returns>An iterator which refers to the past-the-end value for the container. 545 </returns> 546 </overloaded-method> 547 <method name="cbegin" cv="const"> 548 <type>const_iterator</type> 549 <returns>A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 550 </returns> 551 </method> 552 <method name="cend" cv="const"> 553 <type>const_iterator</type> 554 <returns>A constant iterator which refers to the past-the-end value for the container. 555 </returns> 556 </method> 557 </method-group> 558 <method-group name="modifiers"> 559 <method name="emplace"> 560 <template> 561 <template-type-parameter name="Args" pack="1"> 562 </template-type-parameter> 563 </template> 564 <parameter name="args" pack="1"> 565 <paramtype>Args&&</paramtype> 566 </parameter> 567 <type>std::pair<iterator, bool></type> 568 <description> 569 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container if and only if there is no element in the container with an equivalent value.</para> 570 </description> 571 <requires> 572 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 573 <code>X</code> from <code>args</code>. 574 </para> 575 </requires> 576 <returns> 577 <para>The bool component of the return type is true if an insert took place.</para> 578 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 579 </returns> 580 <throws> 581 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 582 </throws> 583 <notes> 584 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 585 <para>Pointers and references to elements are never invalidated.</para> 586 <para>If the compiler doesn't support variadic template arguments or rvalue 587 references, this is emulated for up to 10 arguments, with no support 588 for rvalue references or move semantics.</para> 589 <para>Since existing <code>std::pair</code> implementations don't support 590 <code>std::piecewise_construct</code> this emulates it, 591 but using <code>boost::unordered::piecewise_construct</code>.</para> 592 </notes> 593 </method> 594 <method name="emplace_hint"> 595 <template> 596 <template-type-parameter name="Args" pack="1"> 597 </template-type-parameter> 598 </template> 599 <parameter name="hint"> 600 <paramtype>const_iterator</paramtype> 601 </parameter> 602 <parameter name="args" pack="1"> 603 <paramtype>Args&&</paramtype> 604 </parameter> 605 <type>iterator</type> 606 <description> 607 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container if and only if there is no element in the container with an equivalent value.</para> 608 <para><code>hint</code> is a suggestion to where the element should be inserted.</para> 609 </description> 610 <requires> 611 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 612 <code>X</code> from <code>args</code>. 613 </para> 614 </requires> 615 <returns> 616 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 617 </returns> 618 <throws> 619 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 620 </throws> 621 <notes> 622 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 623 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 624 <para>Pointers and references to elements are never invalidated.</para> 625 <para>If the compiler doesn't support variadic template arguments or rvalue 626 references, this is emulated for up to 10 arguments, with no support 627 for rvalue references or move semantics.</para> 628 <para>Since existing <code>std::pair</code> implementations don't support 629 <code>std::piecewise_construct</code> this emulates it, 630 but using <code>boost::unordered::piecewise_construct</code>.</para> 631 </notes> 632 </method> 633 <method name="insert"> 634 <parameter name="obj"> 635 <paramtype>value_type const&</paramtype> 636 </parameter> 637 <type>std::pair<iterator, bool></type> 638 <description> 639 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent value.</para> 640 </description> 641 <requires> 642 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 643 </requires> 644 <returns> 645 <para>The bool component of the return type is true if an insert took place.</para> 646 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 647 </returns> 648 <throws> 649 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 650 </throws> 651 <notes> 652 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 653 <para>Pointers and references to elements are never invalidated.</para> 654 </notes> 655 </method> 656 <method name="insert"> 657 <parameter name="obj"> 658 <paramtype>value_type&&</paramtype> 659 </parameter> 660 <type>std::pair<iterator, bool></type> 661 <description> 662 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent value.</para> 663 </description> 664 <requires> 665 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 666 </requires> 667 <returns> 668 <para>The bool component of the return type is true if an insert took place.</para> 669 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 670 </returns> 671 <throws> 672 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 673 </throws> 674 <notes> 675 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 676 <para>Pointers and references to elements are never invalidated.</para> 677 </notes> 678 </method> 679 <method name="insert"> 680 <parameter name="hint"> 681 <paramtype>const_iterator</paramtype> 682 </parameter> 683 <parameter name="obj"> 684 <paramtype>value_type const&</paramtype> 685 </parameter> 686 <type>iterator</type> 687 <description> 688 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent value.</para> 689 <para>hint is a suggestion to where the element should be inserted.</para> 690 </description> 691 <requires> 692 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 693 </requires> 694 <returns> 695 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 696 </returns> 697 <throws> 698 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 699 </throws> 700 <notes> 701 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 702 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 703 <para>Pointers and references to elements are never invalidated.</para> 704 </notes> 705 </method> 706 <method name="insert"> 707 <parameter name="hint"> 708 <paramtype>const_iterator</paramtype> 709 </parameter> 710 <parameter name="obj"> 711 <paramtype>value_type&&</paramtype> 712 </parameter> 713 <type>iterator</type> 714 <description> 715 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent value.</para> 716 <para>hint is a suggestion to where the element should be inserted.</para> 717 </description> 718 <requires> 719 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 720 </requires> 721 <returns> 722 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para> 723 </returns> 724 <throws> 725 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 726 </throws> 727 <notes> 728 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 729 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 730 <para>Pointers and references to elements are never invalidated.</para> 731 </notes> 732 </method> 733 <method name="insert"> 734 <template> 735 <template-type-parameter name="InputIterator"> 736 </template-type-parameter> 737 </template> 738 <parameter name="first"> 739 <paramtype>InputIterator</paramtype> 740 </parameter> 741 <parameter name="last"> 742 <paramtype>InputIterator</paramtype> 743 </parameter> 744 <type>void</type> 745 <description> 746 <para>Inserts a range of elements into the container. 747 Elements are inserted if and only if there is no element in the container with an equivalent value. 748 </para> 749 </description> 750 <requires> 751 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 752 <code>X</code> from <code>*first</code>.</para> 753 </requires> 754 <throws> 755 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 756 </throws> 757 <notes> 758 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 759 <para>Pointers and references to elements are never invalidated.</para> 760 </notes> 761 </method> 762 <method name="insert"> 763 <parameter name="il"> 764 <paramtype>initializer_list<value_type></paramtype> 765 </parameter> 766 <type>void</type> 767 <description> 768 <para>Inserts a range of elements into the container. 769 Elements are inserted if and only if there is no element in the container with an equivalent value. 770 </para> 771 </description> 772 <requires> 773 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 774 <code>X</code> from <code>*first</code>.</para> 775 </requires> 776 <throws> 777 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 778 </throws> 779 <notes> 780 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 781 <para>Pointers and references to elements are never invalidated.</para> 782 </notes> 783 </method> 784 <method name="insert"> 785 <parameter name="il"> 786 <paramtype>initializer_list<value_type></paramtype> 787 </parameter> 788 <type>void</type> 789 <description> 790 <para>Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value.</para> 791 </description> 792 <requires> 793 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 794 <code>X</code> from <code>*first</code>.</para> 795 </requires> 796 <throws> 797 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 798 </throws> 799 <notes> 800 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 801 <para>Pointers and references to elements are never invalidated.</para> 802 </notes> 803 </method> 804 <method name="extract"> 805 <parameter name="position"> 806 <paramtype>const_iterator</paramtype> 807 </parameter> 808 <type>node_type</type> 809 <description> 810 <para>Removes the element pointed to by <code>position</code>.</para> 811 </description> 812 <returns> 813 <para>A <code>node_type</code> owning the element.</para> 814 </returns> 815 <notes> 816 <para> 817 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_multiset</code>, 818 but that is not supported yet. 819 </para> 820 </notes> 821 </method> 822 <method name="extract"> 823 <parameter name="k"> 824 <paramtype>key_type const&</paramtype> 825 </parameter> 826 <type>node_type</type> 827 <description> 828 <para>Removes an element with key equivalent to <code>k</code>.</para> 829 </description> 830 <returns> 831 <para>A <code>node_type</code> owning the element if found, otherwise an empty <code>node_type</code>.</para> 832 </returns> 833 <throws> 834 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 835 </throws> 836 <notes> 837 <para> 838 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_multiset</code>, 839 but that is not supported yet. 840 </para> 841 </notes> 842 </method> 843 <method name="insert"> 844 <parameter name="nh"> 845 <paramtype>node_type&&</paramtype> 846 </parameter> 847 <type>insert_return_type</type> 848 <description> 849 <para>If <code>nh</code> is empty, has no affect.</para> 850 <para>Otherwise inserts the element owned by <code>nh</code> 851 if and only if there is no element in the container with an equivalent value. 852 </para> 853 </description> 854 <requires> 855 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 856 </requires> 857 <returns> 858 <para>If <code>nh</code> was empty, returns an <code>insert_return_type</code> with: 859 <code>inserted</code> equal to <code>false</code>, 860 <code>position</code> equal to <code>end()</code> and 861 <code>node</code> empty.</para> 862 <para>Otherwise if there was already an element with an equivalent key, returns an <code>insert_return_type</code> with: 863 <code>inserted</code> equal to <code>false</code>, 864 <code>position</code> pointing to a matching element and 865 <code>node</code> contains the node from <code>nh</code>.</para> 866 <para>Otherwise if the insertion succeeded, returns an <code>insert_return_type</code> with: 867 <code>inserted</code> equal to <code>true</code>, 868 <code>position</code> pointing to the newly inserted element and 869 <code>node</code> empty.</para> 870 </returns> 871 <throws> 872 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 873 </throws> 874 <notes> 875 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 876 <para>Pointers and references to elements are never invalidated.</para> 877 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_multiset</code>, 878 but that is not supported yet.</para> 879 </notes> 880 </method> 881 <method name="insert"> 882 <parameter name="hint"> 883 <paramtype>const_iterator</paramtype> 884 </parameter> 885 <parameter name="nh"> 886 <paramtype>node_type&&</paramtype> 887 </parameter> 888 <type>iterator</type> 889 <description> 890 <para>If <code>nh</code> is empty, has no affect.</para> 891 <para>Otherwise inserts the element owned by <code>nh</code> 892 if and only if there is no element in the container with an equivalent value. 893 </para> 894 <para>If there is already an element in the container with an equivalent value has no effect on <code>nh</code> (i.e. <code>nh</code> still contains the node.)</para> 895 <para>hint is a suggestion to where the element should be inserted.</para> 896 </description> 897 <requires> 898 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 899 </requires> 900 <returns> 901 <para>If <code>nh</code> was empty returns <code>end()</code>.</para> 902 <para>If there was already an element in the container with an equivalent value returns an iterator pointing to that.</para> 903 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 904 </returns> 905 <throws> 906 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 907 </throws> 908 <notes> 909 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 910 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 911 <para>Pointers and references to elements are never invalidated.</para> 912 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_multiset</code>, 913 but that is not supported yet.</para> 914 </notes> 915 </method> 916 <method name="erase"> 917 <parameter name="position"> 918 <paramtype>const_iterator</paramtype> 919 </parameter> 920 <type>iterator</type> 921 <description> 922 <para>Erase the element pointed to by <code>position</code>.</para> 923 </description> 924 <returns> 925 <para>The iterator following <code>position</code> before the erasure.</para> 926 </returns> 927 <throws> 928 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 929 </throws> 930 <notes> 931 <para> 932 In older versions this could be inefficient because it had to search 933 through several buckets to find the position of the returned iterator. 934 The data structure has been changed so that this is no longer the case, 935 and the alternative erase methods have been deprecated. 936 </para> 937 </notes> 938 </method> 939 <method name="erase"> 940 <parameter name="k"> 941 <paramtype>key_type const&</paramtype> 942 </parameter> 943 <type>size_type</type> 944 <description> 945 <para>Erase all elements with key equivalent to <code>k</code>.</para> 946 </description> 947 <returns> 948 <para>The number of elements erased.</para> 949 </returns> 950 <throws> 951 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 952 </throws> 953 </method> 954 <method name="erase"> 955 <parameter name="first"> 956 <paramtype>const_iterator</paramtype> 957 </parameter> 958 <parameter name="last"> 959 <paramtype>const_iterator</paramtype> 960 </parameter> 961 <type>iterator</type> 962 <description> 963 <para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para> 964 </description> 965 <returns> 966 <para>The iterator following the erased elements - i.e. <code>last</code>.</para> 967 </returns> 968 <throws> 969 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 970 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 971 </throws> 972 </method> 973 <method name="quick_erase"> 974 <parameter name="position"> 975 <paramtype>const_iterator</paramtype> 976 </parameter> 977 <type>void</type> 978 <description> 979 <para>Erase the element pointed to by <code>position</code>.</para> 980 </description> 981 <throws> 982 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 983 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 984 </throws> 985 <notes> 986 <para> 987 This method was implemented because returning an iterator to 988 the next element from <code>erase</code> was expensive, but 989 the container has been redesigned so that is no longer the 990 case. So this method is now deprecated. 991 </para> 992 </notes> 993 </method> 994 <method name="erase_return_void"> 995 <parameter name="position"> 996 <paramtype>const_iterator</paramtype> 997 </parameter> 998 <type>void</type> 999 <description> 1000 <para>Erase the element pointed to by <code>position</code>.</para> 1001 </description> 1002 <throws> 1003 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 1004 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 1005 </throws> 1006 <notes> 1007 <para> 1008 This method was implemented because returning an iterator to 1009 the next element from <code>erase</code> was expensive, but 1010 the container has been redesigned so that is no longer the 1011 case. So this method is now deprecated. 1012 </para> 1013 </notes> 1014 </method> 1015 <method name="clear"> 1016 <type>void</type> 1017 <description> 1018 <para>Erases all elements in the container.</para> 1019 </description> 1020 <postconditions> 1021 <para><code><methodname>size</methodname>() == 0</code></para> 1022 </postconditions> 1023 <throws> 1024 <para>Never throws an exception.</para> 1025 </throws> 1026 </method> 1027 <method name="swap"> 1028 <parameter> 1029 <paramtype>unordered_set&</paramtype> 1030 </parameter> 1031 <type>void</type> 1032 <description> 1033 <para>Swaps the contents of the container with the parameter.</para> 1034 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 1035 <code>Allocator::propagate_on_container_swap::value</code> is true then the 1036 containers' allocators are swapped. Otherwise, swapping with unequal allocators 1037 results in undefined behavior.</para> 1038 </description> 1039 <throws> 1040 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 1041 </throws> 1042 <notes> 1043 <para>The exception specifications aren't quite the same as the C++11 standard, as 1044 the equality predieate and hash function are swapped using their copy constructors.</para> 1045 </notes> 1046 </method> 1047 <method name="merge"> 1048 <template> 1049 <template-type-parameter name="H2"> 1050 </template-type-parameter> 1051 <template-type-parameter name="P2"> 1052 </template-type-parameter> 1053 </template> 1054 <parameter name="source"> 1055 <paramtype>unordered_set<Value, H2, P2, Alloc>&</paramtype> 1056 </parameter> 1057 <notes> 1058 <para>Does not support merging with a compatible <code>unordered_multiset</code> yet.</para> 1059 </notes> 1060 </method> 1061 <method name="merge"> 1062 <template> 1063 <template-type-parameter name="H2"> 1064 </template-type-parameter> 1065 <template-type-parameter name="P2"> 1066 </template-type-parameter> 1067 </template> 1068 <parameter name="source"> 1069 <paramtype>unordered_set<Value, H2, P2, Alloc>&&</paramtype> 1070 </parameter> 1071 <notes> 1072 <para>Does not support merging with a compatible <code>unordered_multiset</code> yet.</para> 1073 </notes> 1074 </method> 1075 </method-group> 1076 <method-group name="observers"> 1077 <method name="hash_function" cv="const"> 1078 <type>hasher</type> 1079 <returns>The container's hash function. 1080 </returns> 1081 </method> 1082 <method name="key_eq" cv="const"> 1083 <type>key_equal</type> 1084 <returns>The container's key equality predicate. 1085 </returns> 1086 </method> 1087 </method-group> 1088 <method-group name="lookup"> 1089 <overloaded-method name="find"> 1090 <signature> 1091 <parameter name="k"> 1092 <paramtype>key_type const&</paramtype> 1093 </parameter> 1094 <type>iterator</type> 1095 </signature> 1096 <signature cv="const"> 1097 <parameter name="k"> 1098 <paramtype>key_type const&</paramtype> 1099 </parameter> 1100 <type>const_iterator</type> 1101 </signature> 1102 <signature> 1103 <template> 1104 <template-type-parameter name="CompatibleKey"/> 1105 <template-type-parameter name="CompatibleHash"/> 1106 <template-type-parameter name="CompatiblePredicate"/> 1107 </template> 1108 <parameter name="k"> 1109 <paramtype>CompatibleKey const&</paramtype> 1110 </parameter> 1111 <parameter name="hash"> 1112 <paramtype>CompatibleHash const&</paramtype> 1113 </parameter> 1114 <parameter name="eq"> 1115 <paramtype>CompatiblePredicate const&</paramtype> 1116 </parameter> 1117 <type>iterator</type> 1118 </signature> 1119 <signature cv="const"> 1120 <template> 1121 <template-type-parameter name="CompatibleKey"/> 1122 <template-type-parameter name="CompatibleHash"/> 1123 <template-type-parameter name="CompatiblePredicate"/> 1124 </template> 1125 <parameter name="k"> 1126 <paramtype>CompatibleKey const&</paramtype> 1127 </parameter> 1128 <parameter name="hash"> 1129 <paramtype>CompatibleHash const&</paramtype> 1130 </parameter> 1131 <parameter name="eq"> 1132 <paramtype>CompatiblePredicate const&</paramtype> 1133 </parameter> 1134 <type>const_iterator</type> 1135 </signature> 1136 <returns> 1137 <para>An iterator pointing to an element with key equivalent to <code>k</code>, or <code>b.end()</code> if no such element exists.</para> 1138 </returns> 1139 <notes><para> 1140 The templated overloads are a non-standard extensions which 1141 allows you to use a compatible hash function and equality 1142 predicate for a key of a different type in order to avoid 1143 an expensive type cast. In general, its use is not encouraged. 1144 </para></notes> 1145 </overloaded-method> 1146 <method name="count" cv="const"> 1147 <parameter name="k"> 1148 <paramtype>key_type const&</paramtype> 1149 </parameter> 1150 <type>size_type</type> 1151 <returns> 1152 <para>The number of elements with key equivalent to <code>k</code>.</para> 1153 </returns> 1154 </method> 1155 <overloaded-method name="equal_range"> 1156 <signature> 1157 <parameter name="k"> 1158 <paramtype>key_type const&</paramtype> 1159 </parameter> 1160 <type>std::pair<iterator, iterator></type> 1161 </signature> 1162 <signature cv="const"> 1163 <parameter name="k"> 1164 <paramtype>key_type const&</paramtype> 1165 </parameter> 1166 <type>std::pair<const_iterator, const_iterator></type> 1167 </signature> 1168 <returns> 1169 <para>A range containing all elements with key equivalent to <code>k</code>. 1170 If the container doesn't container any such elements, returns 1171 <code><functionname>std::make_pair</functionname>(<methodname>b.end</methodname>(),<methodname>b.end</methodname>())</code>. 1172 </para> 1173 </returns> 1174 </overloaded-method> 1175 </method-group> 1176 <method-group name="bucket interface"> 1177 <method name="bucket_count" cv="const"> 1178 <type>size_type</type> 1179 <returns> 1180 <para>The number of buckets.</para> 1181 </returns> 1182 </method> 1183 <method name="max_bucket_count" cv="const"> 1184 <type>size_type</type> 1185 <returns> 1186 <para>An upper bound on the number of buckets.</para> 1187 </returns> 1188 </method> 1189 <method name="bucket_size" cv="const"> 1190 <parameter name="n"> 1191 <paramtype>size_type</paramtype> 1192 </parameter> 1193 <type>size_type</type> 1194 <requires> 1195 <para><code>n < <methodname>bucket_count</methodname>()</code></para> 1196 </requires> 1197 <returns> 1198 <para>The number of elements in bucket <code>n</code>.</para> 1199 </returns> 1200 </method> 1201 <method name="bucket" cv="const"> 1202 <parameter name="k"> 1203 <paramtype>key_type const&</paramtype> 1204 </parameter> 1205 <type>size_type</type> 1206 <returns> 1207 <para>The index of the bucket which would contain an element with key <code>k</code>.</para> 1208 </returns> 1209 <postconditions> 1210 <para>The return value is less than <code>bucket_count()</code></para> 1211 </postconditions> 1212 </method> 1213 <overloaded-method name="begin"> 1214 <signature> 1215 <parameter name="n"> 1216 <paramtype>size_type</paramtype> 1217 </parameter> 1218 <type>local_iterator</type> 1219 </signature> 1220 <signature cv="const"> 1221 <parameter name="n"> 1222 <paramtype>size_type</paramtype> 1223 </parameter> 1224 <type>const_local_iterator</type> 1225 </signature> 1226 <requires> 1227 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 1228 </requires> 1229 <returns> 1230 <para>A local iterator pointing the first element in the bucket with index <code>n</code>.</para> 1231 </returns> 1232 </overloaded-method> 1233 <overloaded-method name="end"> 1234 <signature> 1235 <parameter name="n"> 1236 <paramtype>size_type</paramtype> 1237 </parameter> 1238 <type>local_iterator</type> 1239 </signature> 1240 <signature cv="const"> 1241 <parameter name="n"> 1242 <paramtype>size_type</paramtype> 1243 </parameter> 1244 <type>const_local_iterator</type> 1245 </signature> 1246 <requires> 1247 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 1248 </requires> 1249 <returns> 1250 <para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 1251 </returns> 1252 </overloaded-method> 1253 <method name="cbegin" cv="const"> 1254 <parameter name="n"> 1255 <paramtype>size_type</paramtype> 1256 </parameter> 1257 <type>const_local_iterator</type> 1258 <requires> 1259 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 1260 </requires> 1261 <returns> 1262 <para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para> 1263 </returns> 1264 </method> 1265 <method name="cend"> 1266 <parameter name="n"> 1267 <paramtype>size_type</paramtype> 1268 </parameter> 1269 <type>const_local_iterator</type> 1270 <requires> 1271 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 1272 </requires> 1273 <returns> 1274 <para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 1275 </returns> 1276 </method> 1277 </method-group> 1278 <method-group name="hash policy"> 1279 <method name="load_factor" cv="const"> 1280 <type>float</type> 1281 <returns> 1282 <para>The average number of elements per bucket.</para> 1283 </returns> 1284 </method> 1285 <method name="max_load_factor" cv="const"> 1286 <type>float</type> 1287 <returns> 1288 <para>Returns the current maximum load factor.</para> 1289 </returns> 1290 </method> 1291 <method name="max_load_factor"> 1292 <parameter name="z"> 1293 <paramtype>float</paramtype> 1294 </parameter> 1295 <type>void</type> 1296 <effects> 1297 <para>Changes the container's maximum load factor, using <code>z</code> as a hint.</para> 1298 </effects> 1299 </method> 1300 <method name="rehash"> 1301 <parameter name="n"> 1302 <paramtype>size_type</paramtype> 1303 </parameter> 1304 <type>void</type> 1305 <description> 1306 <para>Changes the number of buckets so that there at least <code>n</code> buckets, and so that the load factor is less than the maximum load factor.</para> 1307 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 1308 </description> 1309 <throws> 1310 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 1311 </throws> 1312 </method> 1313 <method name="reserve"> 1314 <parameter name="n"> 1315 <paramtype>size_type</paramtype> 1316 </parameter> 1317 <type>void</type> 1318 <description> 1319 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 1320 </description> 1321 <throws> 1322 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 1323 </throws> 1324 </method> 1325 </method-group> 1326 <free-function-group name="Equality Comparisons"> 1327 <function name="operator=="> 1328 <template> 1329 <template-type-parameter name="Value"> 1330 </template-type-parameter> 1331 <template-type-parameter name="Hash"> 1332 </template-type-parameter> 1333 <template-type-parameter name="Pred"> 1334 </template-type-parameter> 1335 <template-type-parameter name="Alloc"> 1336 </template-type-parameter> 1337 </template> 1338 <parameter name="x"> 1339 <paramtype>unordered_set<Value, Hash, Pred, Alloc> const&</paramtype> 1340 </parameter> 1341 <parameter name="y"> 1342 <paramtype>unordered_set<Value, Hash, Pred, Alloc> const&</paramtype> 1343 </parameter> 1344 <type>bool</type> 1345 <description> 1346 <para>Return <code>true</code> if <code>x.size() == 1347 y.size</code> and for every element in <code>x</code>, 1348 there is an element in <code>y</code> with the same 1349 for the same key, with an equal value (using 1350 <code>operator==</code> to compare the value types). 1351 </para> 1352 </description> 1353 <notes> 1354 <para>The behavior of this function was changed to match 1355 the C++11 standard in Boost 1.48.</para> 1356 <para>Behavior is undefined if the two containers don't have 1357 equivalent equality predicates.</para> 1358 </notes> 1359 </function> 1360 <function name="operator!="> 1361 <template> 1362 <template-type-parameter name="Value"> 1363 </template-type-parameter> 1364 <template-type-parameter name="Hash"> 1365 </template-type-parameter> 1366 <template-type-parameter name="Pred"> 1367 </template-type-parameter> 1368 <template-type-parameter name="Alloc"> 1369 </template-type-parameter> 1370 </template> 1371 <parameter name="x"> 1372 <paramtype>unordered_set<Value, Hash, Pred, Alloc> const&</paramtype> 1373 </parameter> 1374 <parameter name="y"> 1375 <paramtype>unordered_set<Value, Hash, Pred, Alloc> const&</paramtype> 1376 </parameter> 1377 <type>bool</type> 1378 <description> 1379 <para>Return <code>false</code> if <code>x.size() == 1380 y.size</code> and for every element in <code>x</code>, 1381 there is an element in <code>y</code> with the same 1382 for the same key, with an equal value (using 1383 <code>operator==</code> to compare the value types). 1384 </para> 1385 </description> 1386 <notes> 1387 <para>The behavior of this function was changed to match 1388 the C++11 standard in Boost 1.48.</para> 1389 <para>Behavior is undefined if the two containers don't have 1390 equivalent equality predicates.</para> 1391 </notes> 1392 </function> 1393 </free-function-group> 1394 <free-function-group name="swap"> 1395 <function name="swap"> 1396 <template> 1397 <template-type-parameter name="Value"> 1398 </template-type-parameter> 1399 <template-type-parameter name="Hash"> 1400 </template-type-parameter> 1401 <template-type-parameter name="Pred"> 1402 </template-type-parameter> 1403 <template-type-parameter name="Alloc"> 1404 </template-type-parameter> 1405 </template> 1406 <parameter name="x"> 1407 <paramtype>unordered_set<Value, Hash, Pred, Alloc>&</paramtype> 1408 </parameter> 1409 <parameter name="y"> 1410 <paramtype>unordered_set<Value, Hash, Pred, Alloc>&</paramtype> 1411 </parameter> 1412 <type>void</type> 1413 <effects> 1414 <para><code>x.swap(y)</code></para> 1415 </effects> 1416 <description> 1417 <para>Swaps the contents of <code>x</code> and <code>y</code>.</para> 1418 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 1419 <code>Allocator::propagate_on_container_swap::value</code> is true then the 1420 containers' allocators are swapped. Otherwise, swapping with unequal allocators 1421 results in undefined behavior.</para> 1422 </description> 1423 <throws> 1424 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 1425 </throws> 1426 <notes> 1427 <para>The exception specifications aren't quite the same as the C++11 standard, as 1428 the equality predieate and hash function are swapped using their copy constructors.</para> 1429 </notes> 1430 </function> 1431 </free-function-group> 1432 </class> 1433 <class name="unordered_multiset"> 1434 <template> 1435 <template-type-parameter name="Value"> 1436 </template-type-parameter> 1437 <template-type-parameter name="Hash"> 1438 <default><type>boost::hash<Value></type></default> 1439 </template-type-parameter> 1440 <template-type-parameter name="Pred"> 1441 <default><type>std::equal_to<Value></type></default> 1442 </template-type-parameter> 1443 <template-type-parameter name="Alloc"> 1444 <default><type>std::allocator<Value></type></default> 1445 </template-type-parameter> 1446 </template> 1447 <purpose><simpara> 1448 An unordered associative container that stores values. The same key can be stored multiple times. 1449 </simpara></purpose> 1450 <description> 1451 <para><emphasis role="bold">Template Parameters</emphasis> 1452 <informaltable> 1453 <tgroup cols="2"> 1454 <tbody> 1455 <row> 1456 <entry><emphasis>Value</emphasis></entry> 1457 <entry><code>Value</code> must be <code>Erasable</code> from the container 1458 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 1459 </entry></row> 1460 <row> 1461 <entry><emphasis>Hash</emphasis></entry> 1462 <entry>A unary function object type that acts a hash function for a <code>Value</code>. It takes a single argument of type <code>Value</code> and returns a value of type std::size_t.</entry></row> 1463 <row> 1464 <entry><emphasis>Pred</emphasis></entry> 1465 <entry>A binary function object that implements an equivalence relation on values of type <code>Value</code>. 1466 A binary function object that induces an equivalence relation on values of type <code>Value</code>. 1467 It takes two arguments of type <code>Value</code> and returns a value of type bool.</entry></row> 1468 <row> 1469 <entry><emphasis>Alloc</emphasis></entry> 1470 <entry>An allocator whose value type is the same as the container's value type.</entry></row></tbody></tgroup></informaltable></para> 1471 <para>The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other.</para> 1472 <para>The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.</para> 1473 </description> 1474 <typedef name="key_type"> 1475 <type>Value</type> 1476 </typedef> 1477 <typedef name="value_type"> 1478 <type>Value</type> 1479 </typedef> 1480 <typedef name="hasher"> 1481 <type>Hash</type> 1482 </typedef> 1483 <typedef name="key_equal"> 1484 <type>Pred</type> 1485 </typedef> 1486 <typedef name="allocator_type"> 1487 <type>Alloc</type> 1488 </typedef> 1489 <typedef name="pointer"> 1490 <type>typename allocator_type::pointer</type> 1491 <description> 1492 <para> 1493 <code>value_type*</code> if 1494 <code>allocator_type::pointer</code> is not defined. 1495 </para> 1496 </description> 1497 </typedef> 1498 <typedef name="const_pointer"> 1499 <type>typename allocator_type::const_pointer</type> 1500 <description> 1501 <para> 1502 <code>boost::pointer_to_other<pointer, value_type>::type</code> 1503 if <code>allocator_type::const_pointer</code> is not defined. 1504 </para> 1505 </description> 1506 </typedef> 1507 <typedef name="reference"> 1508 <type>value_type&</type> 1509 <purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose> 1510 </typedef> 1511 <typedef name="const_reference"> 1512 <type>value_type const&</type> 1513 <purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose> 1514 </typedef> 1515 <typedef name="size_type"> 1516 <type><emphasis>implementation-defined</emphasis></type> 1517 <description> 1518 <para>An unsigned integral type.</para> 1519 <para><type>size_type</type> can represent any non-negative value of <type>difference_type</type>.</para> 1520 </description> 1521 </typedef> 1522 <typedef name="difference_type"> 1523 <type><emphasis>implementation-defined</emphasis></type> 1524 <description> 1525 <para>A signed integral type.</para> 1526 <para>Is identical to the difference type of <type>iterator</type> and <type>const_iterator</type>.</para> 1527 </description> 1528 </typedef> 1529 <typedef name="iterator"> 1530 <type><emphasis>implementation-defined</emphasis></type> 1531 <description> 1532 <para>A constant iterator whose value type is <type>value_type</type>. </para> 1533 <para>The iterator category is at least a forward iterator.</para> 1534 <para>Convertible to <type>const_iterator</type>.</para> 1535 </description> 1536 </typedef> 1537 <typedef name="const_iterator"> 1538 <type><emphasis>implementation-defined</emphasis></type> 1539 <description> 1540 <para>A constant iterator whose value type is <type>value_type</type>. </para> 1541 <para>The iterator category is at least a forward iterator.</para> 1542 </description> 1543 </typedef> 1544 <typedef name="local_iterator"> 1545 <type><emphasis>implementation-defined</emphasis></type> 1546 <description> 1547 <para>An iterator with the same value type, difference type and pointer and reference type as <type>iterator</type>.</para> 1548 <para>A local_iterator object can be used to iterate through a single bucket.</para> 1549 </description> 1550 </typedef> 1551 <typedef name="const_local_iterator"> 1552 <type><emphasis>implementation-defined</emphasis></type> 1553 <description> 1554 <para>A constant iterator with the same value type, difference type and pointer and reference type as <type>const_iterator</type>.</para> 1555 <para>A const_local_iterator object can be used to iterate through a single bucket.</para> 1556 </description> 1557 </typedef> 1558 <typedef name="node_type"> 1559 <type><emphasis>implementation-defined</emphasis></type> 1560 <description> 1561 <para>See <classname>node_handle_set</classname> for details.</para> 1562 </description> 1563 </typedef> 1564 <constructor> 1565 <postconditions> 1566 <code><methodname>size</methodname>() == 0</code> 1567 </postconditions> 1568 <description> 1569 <para>Constructs an empty container using hasher() as the hash function, key_equal() as the key equality predicate, allocator_type() as the allocator and a maximum load factor of 1.0.</para> 1570 </description> 1571 <requires> 1572 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 1573 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 1574 </para> 1575 </requires> 1576 </constructor> 1577 <constructor specifiers="explicit"> 1578 <parameter name="n"> 1579 <paramtype>size_type</paramtype> 1580 </parameter> 1581 <parameter name="hf"> 1582 <paramtype>hasher const&</paramtype> 1583 <default>hasher()</default> 1584 </parameter> 1585 <parameter name="eq"> 1586 <paramtype>key_equal const&</paramtype> 1587 <default>key_equal()</default> 1588 </parameter> 1589 <parameter name="a"> 1590 <paramtype>allocator_type const&</paramtype> 1591 <default>allocator_type()</default> 1592 </parameter> 1593 <postconditions> 1594 <code><methodname>size</methodname>() == 0</code> 1595 </postconditions> 1596 <description> 1597 <para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para> 1598 </description> 1599 <requires> 1600 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 1601 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 1602 </para> 1603 </requires> 1604 </constructor> 1605 <constructor> 1606 <template> 1607 <template-type-parameter name="InputIterator"> 1608 </template-type-parameter> 1609 </template> 1610 <parameter name="f"> 1611 <paramtype>InputIterator</paramtype> 1612 </parameter> 1613 <parameter name="l"> 1614 <paramtype>InputIterator</paramtype> 1615 </parameter> 1616 <parameter name="n"> 1617 <paramtype>size_type</paramtype> 1618 <default><emphasis>implementation-defined</emphasis></default> 1619 </parameter> 1620 <parameter name="hf"> 1621 <paramtype>hasher const&</paramtype> 1622 <default>hasher()</default> 1623 </parameter> 1624 <parameter name="eq"> 1625 <paramtype>key_equal const&</paramtype> 1626 <default>key_equal()</default> 1627 </parameter> 1628 <parameter name="a"> 1629 <paramtype>allocator_type const&</paramtype> 1630 <default>allocator_type()</default> 1631 </parameter> 1632 <description> 1633 <para>Constructs an empty container with at least <code>n</code> buckets, 1634 using <code>hf</code> as the hash function, 1635 <code>eq</code> as the key equality predicate, 1636 <code>a</code> as the allocator and a maximum load factor of 1.0 1637 and inserts the elements from [f, l) into it. 1638 </para> 1639 </description> 1640 <requires> 1641 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 1642 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 1643 </para> 1644 </requires> 1645 </constructor> 1646 <constructor> 1647 <parameter> 1648 <paramtype>unordered_multiset const&</paramtype> 1649 </parameter> 1650 <description> 1651 <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para> 1652 <para>If <code>Allocator::select_on_container_copy_construction</code> 1653 exists and has the right signature, the allocator will be 1654 constructed from its result.</para> 1655 </description> 1656 <requires> 1657 <para><code>value_type</code> is copy constructible</para> 1658 </requires> 1659 </constructor> 1660 <constructor> 1661 <parameter> 1662 <paramtype>unordered_multiset &&</paramtype> 1663 </parameter> 1664 <description> 1665 <para>The move constructor.</para> 1666 </description> 1667 <notes> 1668 <para>This is implemented using Boost.Move.</para> 1669 </notes> 1670 <requires> 1671 <para> 1672 <code>value_type</code> is move constructible. 1673 </para> 1674 <para> 1675 On compilers without rvalue reference support the 1676 emulation does not support moving without calling 1677 <code>boost::move</code> if <code>value_type</code> is 1678 not copyable. So, for example, you can't return the 1679 container from a function. 1680 </para> 1681 </requires> 1682 </constructor> 1683 <constructor specifiers="explicit"> 1684 <parameter name="a"> 1685 <paramtype>Allocator const&</paramtype> 1686 </parameter> 1687 <description> 1688 <para>Constructs an empty container, using allocator <code>a</code>.</para> 1689 </description> 1690 </constructor> 1691 <constructor> 1692 <parameter name="x"> 1693 <paramtype>unordered_multiset const&</paramtype> 1694 </parameter> 1695 <parameter name="a"> 1696 <paramtype>Allocator const&</paramtype> 1697 </parameter> 1698 <description> 1699 <para>Constructs an container, copying <code>x</code>'s contained elements, hash function, predicate, maximum load factor, but using allocator <code>a</code>.</para> 1700 </description> 1701 </constructor> 1702 <constructor> 1703 <parameter name="x"> 1704 <paramtype>unordered_multiset &&</paramtype> 1705 </parameter> 1706 <parameter name="a"> 1707 <paramtype>Allocator const&</paramtype> 1708 </parameter> 1709 <description> 1710 <para>Construct a container moving <code>x</code>'s contained elements, and having the hash function, predicate and maximum load factor, but using allocate <code>a</code>.</para> 1711 </description> 1712 <notes> 1713 <para>This is implemented using Boost.Move.</para> 1714 </notes> 1715 <requires> 1716 <para> 1717 <code>value_type</code> is move insertable. 1718 </para> 1719 </requires> 1720 </constructor> 1721 <constructor> 1722 <parameter name="il"> 1723 <paramtype>initializer_list<value_type></paramtype> 1724 </parameter> 1725 <parameter name="n"> 1726 <paramtype>size_type</paramtype> 1727 <default><emphasis>implementation-defined</emphasis></default> 1728 </parameter> 1729 <parameter name="hf"> 1730 <paramtype>hasher const&</paramtype> 1731 <default>hasher()</default> 1732 </parameter> 1733 <parameter name="eq"> 1734 <paramtype>key_equal const&</paramtype> 1735 <default>key_equal()</default> 1736 </parameter> 1737 <parameter name="a"> 1738 <paramtype>allocator_type const&</paramtype> 1739 <default>allocator_type()</default> 1740 </parameter> 1741 <description> 1742 <para>Constructs an empty container with at least <code>n</code> buckets, 1743 using <code>hf</code> as the hash function, 1744 <code>eq</code> as the key equality predicate, 1745 <code>a</code> as the allocator and a maximum load factor of 1.0 1746 and inserts the elements from <code>il</code> into it. 1747 </para> 1748 </description> 1749 <requires> 1750 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 1751 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 1752 </para> 1753 </requires> 1754 </constructor> 1755 <constructor> 1756 <parameter name="n"> 1757 <paramtype>size_type</paramtype> 1758 </parameter> 1759 <parameter name="a"> 1760 <paramtype>allocator_type const&</paramtype> 1761 </parameter> 1762 <postconditions> 1763 <code><methodname>size</methodname>() == 0</code> 1764 </postconditions> 1765 <description> 1766 <para>Constructs an empty container with at least <code>n</code> buckets, 1767 using <code>hf</code> as the hash function, 1768 the default hash function and key equality predicate, 1769 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 1770 </description> 1771 <requires> 1772 <para><code>hasher</code> and <code>key_equal</code> need to be <code>DefaultConstructible</code>. 1773 </para> 1774 </requires> 1775 </constructor> 1776 <constructor> 1777 <parameter name="n"> 1778 <paramtype>size_type</paramtype> 1779 </parameter> 1780 <parameter name="hf"> 1781 <paramtype>hasher const&</paramtype> 1782 </parameter> 1783 <parameter name="a"> 1784 <paramtype>allocator_type const&</paramtype> 1785 </parameter> 1786 <postconditions> 1787 <code><methodname>size</methodname>() == 0</code> 1788 </postconditions> 1789 <description> 1790 <para>Constructs an empty container with at least <code>n</code> buckets, 1791 using <code>hf</code> as the hash function, 1792 the default key equality predicate, 1793 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 1794 </description> 1795 <requires> 1796 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 1797 </para> 1798 </requires> 1799 </constructor> 1800 <constructor> 1801 <template> 1802 <template-type-parameter name="InputIterator"> 1803 </template-type-parameter> 1804 </template> 1805 <parameter name="f"> 1806 <paramtype>InputIterator</paramtype> 1807 </parameter> 1808 <parameter name="l"> 1809 <paramtype>InputIterator</paramtype> 1810 </parameter> 1811 <parameter name="n"> 1812 <paramtype>size_type</paramtype> 1813 </parameter> 1814 <parameter name="a"> 1815 <paramtype>allocator_type const&</paramtype> 1816 </parameter> 1817 <description> 1818 <para>Constructs an empty container with at least <code>n</code> buckets, 1819 using <code>a</code> as the allocator, with the 1820 default hash function and key equality predicate 1821 and a maximum load factor of 1.0 1822 and inserts the elements from [f, l) into it. 1823 </para> 1824 </description> 1825 <requires> 1826 <para><code>hasher</code>, <code>key_equal</code> need to be <code>DefaultConstructible</code>. 1827 </para> 1828 </requires> 1829 </constructor> 1830 <constructor> 1831 <template> 1832 <template-type-parameter name="InputIterator"> 1833 </template-type-parameter> 1834 </template> 1835 <parameter name="f"> 1836 <paramtype>InputIterator</paramtype> 1837 </parameter> 1838 <parameter name="l"> 1839 <paramtype>InputIterator</paramtype> 1840 </parameter> 1841 <parameter name="n"> 1842 <paramtype>size_type</paramtype> 1843 </parameter> 1844 <parameter name="hf"> 1845 <paramtype>hasher const&</paramtype> 1846 </parameter> 1847 <parameter name="a"> 1848 <paramtype>allocator_type const&</paramtype> 1849 </parameter> 1850 <description> 1851 <para>Constructs an empty container with at least <code>n</code> buckets, 1852 using <code>hf</code> as the hash function, 1853 <code>a</code> as the allocator, with the 1854 default key equality predicate 1855 and a maximum load factor of 1.0 1856 and inserts the elements from [f, l) into it. 1857 </para> 1858 </description> 1859 <requires> 1860 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 1861 </para> 1862 </requires> 1863 </constructor> 1864 <destructor> 1865 <notes> 1866 <para>The destructor is applied to every element, and all memory is deallocated</para> 1867 </notes> 1868 </destructor> 1869 <method name="operator="> 1870 <parameter> 1871 <paramtype>unordered_multiset const&</paramtype> 1872 </parameter> 1873 <type>unordered_multiset&</type> 1874 <description> 1875 <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para> 1876 <para>If <code>Alloc::propagate_on_container_copy_assignment</code> 1877 exists and <code>Alloc::propagate_on_container_copy_assignment::value 1878 </code> is true, the allocator is overwritten, if not the 1879 copied elements are created using the existing 1880 allocator.</para> 1881 </description> 1882 <requires> 1883 <para><code>value_type</code> is copy constructible</para> 1884 </requires> 1885 </method> 1886 <method name="operator="> 1887 <parameter> 1888 <paramtype>unordered_multiset &&</paramtype> 1889 </parameter> 1890 <type>unordered_multiset&</type> 1891 <description> 1892 <para>The move assignment operator.</para> 1893 <para>If <code>Alloc::propagate_on_container_move_assignment</code> 1894 exists and <code>Alloc::propagate_on_container_move_assignment::value 1895 </code> is true, the allocator is overwritten, if not the 1896 moved elements are created using the existing 1897 allocator.</para> 1898 </description> 1899 <notes> 1900 <para> 1901 On compilers without rvalue references, this is emulated using 1902 Boost.Move. Note that on some compilers the copy assignment 1903 operator may be used in some circumstances. 1904 </para> 1905 </notes> 1906 <requires> 1907 <para> 1908 <code>value_type</code> is move constructible. 1909 </para> 1910 </requires> 1911 </method> 1912 <method name="operator="> 1913 <parameter> 1914 <paramtype>initializer_list<value_type></paramtype> 1915 </parameter> 1916 <type>unordered_multiset&</type> 1917 <description> 1918 <para>Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed.</para> 1919 </description> 1920 <requires> 1921 <para> 1922 <code>value_type</code> is <code>CopyInsertable</code> into the container and 1923 <code>CopyAssignable</code>. 1924 </para> 1925 </requires> 1926 </method> 1927 <method name="get_allocator" cv="const"> 1928 <type>allocator_type</type> 1929 </method> 1930 <method-group name="size and capacity"> 1931 <method name="empty" cv="const"> 1932 <type>bool</type> 1933 <returns> 1934 <code><methodname>size</methodname>() == 0</code> 1935 </returns> 1936 </method> 1937 <method name="size" cv="const"> 1938 <type>size_type</type> 1939 <returns> 1940 <code>std::distance(<methodname>begin</methodname>(), <methodname>end</methodname>())</code> 1941 </returns> 1942 </method> 1943 <method name="max_size" cv="const"> 1944 <type>size_type</type> 1945 <returns><code><methodname>size</methodname>()</code> of the largest possible container. 1946 </returns> 1947 </method> 1948 </method-group> 1949 <method-group name="iterators"> 1950 <overloaded-method name="begin"> 1951 <signature><type>iterator</type></signature> 1952 <signature cv="const"><type>const_iterator</type></signature> 1953 <returns>An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 1954 </returns> 1955 </overloaded-method> 1956 <overloaded-method name="end"> 1957 <signature> 1958 <type>iterator</type> 1959 </signature> 1960 <signature cv="const"> 1961 <type>const_iterator</type> 1962 </signature> 1963 <returns>An iterator which refers to the past-the-end value for the container. 1964 </returns> 1965 </overloaded-method> 1966 <method name="cbegin" cv="const"> 1967 <type>const_iterator</type> 1968 <returns>A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 1969 </returns> 1970 </method> 1971 <method name="cend" cv="const"> 1972 <type>const_iterator</type> 1973 <returns>A constant iterator which refers to the past-the-end value for the container. 1974 </returns> 1975 </method> 1976 </method-group> 1977 <method-group name="modifiers"> 1978 <method name="emplace"> 1979 <template> 1980 <template-type-parameter name="Args" pack="1"> 1981 </template-type-parameter> 1982 </template> 1983 <parameter name="args" pack="1"> 1984 <paramtype>Args&&</paramtype> 1985 </parameter> 1986 <type>iterator</type> 1987 <description> 1988 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container.</para> 1989 </description> 1990 <requires> 1991 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 1992 <code>X</code> from <code>args</code>. 1993 </para> 1994 </requires> 1995 <returns> 1996 <para>An iterator pointing to the inserted element.</para> 1997 </returns> 1998 <throws> 1999 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2000 </throws> 2001 <notes> 2002 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2003 <para>Pointers and references to elements are never invalidated.</para> 2004 <para>If the compiler doesn't support variadic template arguments or rvalue 2005 references, this is emulated for up to 10 arguments, with no support 2006 for rvalue references or move semantics.</para> 2007 <para>Since existing <code>std::pair</code> implementations don't support 2008 <code>std::piecewise_construct</code> this emulates it, 2009 but using <code>boost::unordered::piecewise_construct</code>.</para> 2010 </notes> 2011 </method> 2012 <method name="emplace_hint"> 2013 <template> 2014 <template-type-parameter name="Args" pack="1"> 2015 </template-type-parameter> 2016 </template> 2017 <parameter name="hint"> 2018 <paramtype>const_iterator</paramtype> 2019 </parameter> 2020 <parameter name="args" pack="1"> 2021 <paramtype>Args&&</paramtype> 2022 </parameter> 2023 <type>iterator</type> 2024 <description> 2025 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container.</para> 2026 <para><code>hint</code> is a suggestion to where the element should be inserted.</para> 2027 </description> 2028 <requires> 2029 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 2030 <code>X</code> from <code>args</code>. 2031 </para> 2032 </requires> 2033 <returns> 2034 <para>An iterator pointing to the inserted element.</para> 2035 </returns> 2036 <throws> 2037 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2038 </throws> 2039 <notes> 2040 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 2041 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2042 <para>Pointers and references to elements are never invalidated.</para> 2043 <para>If the compiler doesn't support variadic template arguments or rvalue 2044 references, this is emulated for up to 10 arguments, with no support 2045 for rvalue references or move semantics.</para> 2046 <para>Since existing <code>std::pair</code> implementations don't support 2047 <code>std::piecewise_construct</code> this emulates it, 2048 but using <code>boost::unordered::piecewise_construct</code>.</para> 2049 </notes> 2050 </method> 2051 <method name="insert"> 2052 <parameter name="obj"> 2053 <paramtype>value_type const&</paramtype> 2054 </parameter> 2055 <type>iterator</type> 2056 <description> 2057 <para>Inserts <code>obj</code> in the container.</para> 2058 </description> 2059 <requires> 2060 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 2061 </requires> 2062 <returns> 2063 <para>An iterator pointing to the inserted element.</para> 2064 </returns> 2065 <throws> 2066 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2067 </throws> 2068 <notes> 2069 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2070 <para>Pointers and references to elements are never invalidated.</para> 2071 </notes> 2072 </method> 2073 <method name="insert"> 2074 <parameter name="obj"> 2075 <paramtype>value_type&&</paramtype> 2076 </parameter> 2077 <type>iterator</type> 2078 <description> 2079 <para>Inserts <code>obj</code> in the container.</para> 2080 </description> 2081 <requires> 2082 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 2083 </requires> 2084 <returns> 2085 <para>An iterator pointing to the inserted element.</para> 2086 </returns> 2087 <throws> 2088 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2089 </throws> 2090 <notes> 2091 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2092 <para>Pointers and references to elements are never invalidated.</para> 2093 </notes> 2094 </method> 2095 <method name="insert"> 2096 <parameter name="hint"> 2097 <paramtype>const_iterator</paramtype> 2098 </parameter> 2099 <parameter name="obj"> 2100 <paramtype>value_type const&</paramtype> 2101 </parameter> 2102 <type>iterator</type> 2103 <description> 2104 <para>Inserts <code>obj</code> in the container.</para> 2105 <para>hint is a suggestion to where the element should be inserted.</para> 2106 </description> 2107 <requires> 2108 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 2109 </requires> 2110 <returns> 2111 <para>An iterator pointing to the inserted element.</para> 2112 </returns> 2113 <throws> 2114 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2115 </throws> 2116 <notes> 2117 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 2118 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2119 <para>Pointers and references to elements are never invalidated.</para> 2120 </notes> 2121 </method> 2122 <method name="insert"> 2123 <parameter name="hint"> 2124 <paramtype>const_iterator</paramtype> 2125 </parameter> 2126 <parameter name="obj"> 2127 <paramtype>value_type&&</paramtype> 2128 </parameter> 2129 <type>iterator</type> 2130 <description> 2131 <para>Inserts <code>obj</code> in the container.</para> 2132 <para>hint is a suggestion to where the element should be inserted.</para> 2133 </description> 2134 <requires> 2135 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 2136 </requires> 2137 <returns> 2138 <para>An iterator pointing to the inserted element.</para> 2139 </returns> 2140 <throws> 2141 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2142 </throws> 2143 <notes> 2144 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 2145 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2146 <para>Pointers and references to elements are never invalidated.</para> 2147 </notes> 2148 </method> 2149 <method name="insert"> 2150 <template> 2151 <template-type-parameter name="InputIterator"> 2152 </template-type-parameter> 2153 </template> 2154 <parameter name="first"> 2155 <paramtype>InputIterator</paramtype> 2156 </parameter> 2157 <parameter name="last"> 2158 <paramtype>InputIterator</paramtype> 2159 </parameter> 2160 <type>void</type> 2161 <description> 2162 <para>Inserts a range of elements into the container. 2163 </para> 2164 </description> 2165 <requires> 2166 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 2167 <code>X</code> from <code>*first</code>.</para> 2168 </requires> 2169 <throws> 2170 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2171 </throws> 2172 <notes> 2173 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2174 <para>Pointers and references to elements are never invalidated.</para> 2175 </notes> 2176 </method> 2177 <method name="insert"> 2178 <parameter name="il"> 2179 <paramtype>initializer_list<value_type></paramtype> 2180 </parameter> 2181 <type>void</type> 2182 <description> 2183 <para>Inserts a range of elements into the container. 2184 </para> 2185 </description> 2186 <requires> 2187 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 2188 <code>X</code> from <code>*first</code>.</para> 2189 </requires> 2190 <throws> 2191 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2192 </throws> 2193 <notes> 2194 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2195 <para>Pointers and references to elements are never invalidated.</para> 2196 </notes> 2197 </method> 2198 <method name="insert"> 2199 <parameter name="il"> 2200 <paramtype>initializer_list<value_type></paramtype> 2201 </parameter> 2202 <type>void</type> 2203 <description> 2204 <para>Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value.</para> 2205 </description> 2206 <requires> 2207 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 2208 <code>X</code> from <code>*first</code>.</para> 2209 </requires> 2210 <throws> 2211 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2212 </throws> 2213 <notes> 2214 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2215 <para>Pointers and references to elements are never invalidated.</para> 2216 </notes> 2217 </method> 2218 <method name="extract"> 2219 <parameter name="position"> 2220 <paramtype>const_iterator</paramtype> 2221 </parameter> 2222 <type>node_type</type> 2223 <description> 2224 <para>Removes the element pointed to by <code>position</code>.</para> 2225 </description> 2226 <returns> 2227 <para>A <code>node_type</code> owning the element.</para> 2228 </returns> 2229 <notes> 2230 <para> 2231 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_set</code>, 2232 but that is not supported yet. 2233 </para> 2234 </notes> 2235 </method> 2236 <method name="extract"> 2237 <parameter name="k"> 2238 <paramtype>key_type const&</paramtype> 2239 </parameter> 2240 <type>node_type</type> 2241 <description> 2242 <para>Removes an element with key equivalent to <code>k</code>.</para> 2243 </description> 2244 <returns> 2245 <para>A <code>node_type</code> owning the element if found, otherwise an empty <code>node_type</code>.</para> 2246 </returns> 2247 <throws> 2248 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2249 </throws> 2250 <notes> 2251 <para> 2252 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_set</code>, 2253 but that is not supported yet. 2254 </para> 2255 </notes> 2256 </method> 2257 <method name="insert"> 2258 <parameter name="nh"> 2259 <paramtype>node_type&&</paramtype> 2260 </parameter> 2261 <type>iterator</type> 2262 <description> 2263 <para>If <code>nh</code> is empty, has no affect.</para> 2264 <para>Otherwise inserts the element owned by <code>nh</code></para> 2265 </description> 2266 <requires> 2267 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 2268 </requires> 2269 <returns> 2270 <para>If <code>nh</code> was empty, returns <code>end()</code>.</para> 2271 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 2272 </returns> 2273 <throws> 2274 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2275 </throws> 2276 <notes> 2277 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2278 <para>Pointers and references to elements are never invalidated.</para> 2279 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_set</code>, 2280 but that is not supported yet.</para> 2281 </notes> 2282 </method> 2283 <method name="insert"> 2284 <parameter name="hint"> 2285 <paramtype>const_iterator</paramtype> 2286 </parameter> 2287 <parameter name="nh"> 2288 <paramtype>node_type&&</paramtype> 2289 </parameter> 2290 <type>iterator</type> 2291 <description> 2292 <para>If <code>nh</code> is empty, has no affect.</para> 2293 <para>Otherwise inserts the element owned by <code>nh</code></para> 2294 <para>hint is a suggestion to where the element should be inserted.</para> 2295 </description> 2296 <requires> 2297 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 2298 </requires> 2299 <returns> 2300 <para>If <code>nh</code> was empty, returns <code>end()</code>.</para> 2301 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 2302 </returns> 2303 <throws> 2304 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 2305 </throws> 2306 <notes> 2307 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. </para> 2308 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 2309 <para>Pointers and references to elements are never invalidated.</para> 2310 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_set</code>, 2311 but that is not supported yet.</para> 2312 </notes> 2313 </method> 2314 <method name="erase"> 2315 <parameter name="position"> 2316 <paramtype>const_iterator</paramtype> 2317 </parameter> 2318 <type>iterator</type> 2319 <description> 2320 <para>Erase the element pointed to by <code>position</code>.</para> 2321 </description> 2322 <returns> 2323 <para>The iterator following <code>position</code> before the erasure.</para> 2324 </returns> 2325 <throws> 2326 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2327 </throws> 2328 <notes> 2329 <para> 2330 In older versions this could be inefficient because it had to search 2331 through several buckets to find the position of the returned iterator. 2332 The data structure has been changed so that this is no longer the case, 2333 and the alternative erase methods have been deprecated. 2334 </para> 2335 </notes> 2336 </method> 2337 <method name="erase"> 2338 <parameter name="k"> 2339 <paramtype>key_type const&</paramtype> 2340 </parameter> 2341 <type>size_type</type> 2342 <description> 2343 <para>Erase all elements with key equivalent to <code>k</code>.</para> 2344 </description> 2345 <returns> 2346 <para>The number of elements erased.</para> 2347 </returns> 2348 <throws> 2349 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2350 </throws> 2351 </method> 2352 <method name="erase"> 2353 <parameter name="first"> 2354 <paramtype>const_iterator</paramtype> 2355 </parameter> 2356 <parameter name="last"> 2357 <paramtype>const_iterator</paramtype> 2358 </parameter> 2359 <type>iterator</type> 2360 <description> 2361 <para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para> 2362 </description> 2363 <returns> 2364 <para>The iterator following the erased elements - i.e. <code>last</code>.</para> 2365 </returns> 2366 <throws> 2367 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2368 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 2369 </throws> 2370 </method> 2371 <method name="quick_erase"> 2372 <parameter name="position"> 2373 <paramtype>const_iterator</paramtype> 2374 </parameter> 2375 <type>void</type> 2376 <description> 2377 <para>Erase the element pointed to by <code>position</code>.</para> 2378 </description> 2379 <throws> 2380 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2381 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 2382 </throws> 2383 <notes> 2384 <para> 2385 This method was implemented because returning an iterator to 2386 the next element from <code>erase</code> was expensive, but 2387 the container has been redesigned so that is no longer the 2388 case. So this method is now deprecated. 2389 </para> 2390 </notes> 2391 </method> 2392 <method name="erase_return_void"> 2393 <parameter name="position"> 2394 <paramtype>const_iterator</paramtype> 2395 </parameter> 2396 <type>void</type> 2397 <description> 2398 <para>Erase the element pointed to by <code>position</code>.</para> 2399 </description> 2400 <throws> 2401 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 2402 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 2403 </throws> 2404 <notes> 2405 <para> 2406 This method was implemented because returning an iterator to 2407 the next element from <code>erase</code> was expensive, but 2408 the container has been redesigned so that is no longer the 2409 case. So this method is now deprecated. 2410 </para> 2411 </notes> 2412 </method> 2413 <method name="clear"> 2414 <type>void</type> 2415 <description> 2416 <para>Erases all elements in the container.</para> 2417 </description> 2418 <postconditions> 2419 <para><code><methodname>size</methodname>() == 0</code></para> 2420 </postconditions> 2421 <throws> 2422 <para>Never throws an exception.</para> 2423 </throws> 2424 </method> 2425 <method name="swap"> 2426 <parameter> 2427 <paramtype>unordered_multiset&</paramtype> 2428 </parameter> 2429 <type>void</type> 2430 <description> 2431 <para>Swaps the contents of the container with the parameter.</para> 2432 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 2433 <code>Allocator::propagate_on_container_swap::value</code> is true then the 2434 containers' allocators are swapped. Otherwise, swapping with unequal allocators 2435 results in undefined behavior.</para> 2436 </description> 2437 <throws> 2438 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 2439 </throws> 2440 <notes> 2441 <para>The exception specifications aren't quite the same as the C++11 standard, as 2442 the equality predieate and hash function are swapped using their copy constructors.</para> 2443 </notes> 2444 </method> 2445 <method name="merge"> 2446 <template> 2447 <template-type-parameter name="H2"> 2448 </template-type-parameter> 2449 <template-type-parameter name="P2"> 2450 </template-type-parameter> 2451 </template> 2452 <parameter name="source"> 2453 <paramtype>unordered_multiset<Value, H2, P2, Alloc>&</paramtype> 2454 </parameter> 2455 <notes> 2456 <para>Does not support merging with a compatible <code>unordered_set</code> yet.</para> 2457 </notes> 2458 </method> 2459 <method name="merge"> 2460 <template> 2461 <template-type-parameter name="H2"> 2462 </template-type-parameter> 2463 <template-type-parameter name="P2"> 2464 </template-type-parameter> 2465 </template> 2466 <parameter name="source"> 2467 <paramtype>unordered_multiset<Value, H2, P2, Alloc>&&</paramtype> 2468 </parameter> 2469 <notes> 2470 <para>Does not support merging with a compatible <code>unordered_set</code> yet.</para> 2471 </notes> 2472 </method> 2473 </method-group> 2474 <method-group name="observers"> 2475 <method name="hash_function" cv="const"> 2476 <type>hasher</type> 2477 <returns>The container's hash function. 2478 </returns> 2479 </method> 2480 <method name="key_eq" cv="const"> 2481 <type>key_equal</type> 2482 <returns>The container's key equality predicate. 2483 </returns> 2484 </method> 2485 </method-group> 2486 <method-group name="lookup"> 2487 <overloaded-method name="find"> 2488 <signature> 2489 <parameter name="k"> 2490 <paramtype>key_type const&</paramtype> 2491 </parameter> 2492 <type>iterator</type> 2493 </signature> 2494 <signature cv="const"> 2495 <parameter name="k"> 2496 <paramtype>key_type const&</paramtype> 2497 </parameter> 2498 <type>const_iterator</type> 2499 </signature> 2500 <signature> 2501 <template> 2502 <template-type-parameter name="CompatibleKey"/> 2503 <template-type-parameter name="CompatibleHash"/> 2504 <template-type-parameter name="CompatiblePredicate"/> 2505 </template> 2506 <parameter name="k"> 2507 <paramtype>CompatibleKey const&</paramtype> 2508 </parameter> 2509 <parameter name="hash"> 2510 <paramtype>CompatibleHash const&</paramtype> 2511 </parameter> 2512 <parameter name="eq"> 2513 <paramtype>CompatiblePredicate const&</paramtype> 2514 </parameter> 2515 <type>iterator</type> 2516 </signature> 2517 <signature cv="const"> 2518 <template> 2519 <template-type-parameter name="CompatibleKey"/> 2520 <template-type-parameter name="CompatibleHash"/> 2521 <template-type-parameter name="CompatiblePredicate"/> 2522 </template> 2523 <parameter name="k"> 2524 <paramtype>CompatibleKey const&</paramtype> 2525 </parameter> 2526 <parameter name="hash"> 2527 <paramtype>CompatibleHash const&</paramtype> 2528 </parameter> 2529 <parameter name="eq"> 2530 <paramtype>CompatiblePredicate const&</paramtype> 2531 </parameter> 2532 <type>const_iterator</type> 2533 </signature> 2534 <returns> 2535 <para>An iterator pointing to an element with key equivalent to <code>k</code>, or <code>b.end()</code> if no such element exists.</para> 2536 </returns> 2537 <notes><para> 2538 The templated overloads are a non-standard extensions which 2539 allows you to use a compatible hash function and equality 2540 predicate for a key of a different type in order to avoid 2541 an expensive type cast. In general, its use is not encouraged. 2542 </para></notes> 2543 </overloaded-method> 2544 <method name="count" cv="const"> 2545 <parameter name="k"> 2546 <paramtype>key_type const&</paramtype> 2547 </parameter> 2548 <type>size_type</type> 2549 <returns> 2550 <para>The number of elements with key equivalent to <code>k</code>.</para> 2551 </returns> 2552 </method> 2553 <overloaded-method name="equal_range"> 2554 <signature> 2555 <parameter name="k"> 2556 <paramtype>key_type const&</paramtype> 2557 </parameter> 2558 <type>std::pair<iterator, iterator></type> 2559 </signature> 2560 <signature cv="const"> 2561 <parameter name="k"> 2562 <paramtype>key_type const&</paramtype> 2563 </parameter> 2564 <type>std::pair<const_iterator, const_iterator></type> 2565 </signature> 2566 <returns> 2567 <para>A range containing all elements with key equivalent to <code>k</code>. 2568 If the container doesn't container any such elements, returns 2569 <code><functionname>std::make_pair</functionname>(<methodname>b.end</methodname>(),<methodname>b.end</methodname>())</code>. 2570 </para> 2571 </returns> 2572 </overloaded-method> 2573 </method-group> 2574 <method-group name="bucket interface"> 2575 <method name="bucket_count" cv="const"> 2576 <type>size_type</type> 2577 <returns> 2578 <para>The number of buckets.</para> 2579 </returns> 2580 </method> 2581 <method name="max_bucket_count" cv="const"> 2582 <type>size_type</type> 2583 <returns> 2584 <para>An upper bound on the number of buckets.</para> 2585 </returns> 2586 </method> 2587 <method name="bucket_size" cv="const"> 2588 <parameter name="n"> 2589 <paramtype>size_type</paramtype> 2590 </parameter> 2591 <type>size_type</type> 2592 <requires> 2593 <para><code>n < <methodname>bucket_count</methodname>()</code></para> 2594 </requires> 2595 <returns> 2596 <para>The number of elements in bucket <code>n</code>.</para> 2597 </returns> 2598 </method> 2599 <method name="bucket" cv="const"> 2600 <parameter name="k"> 2601 <paramtype>key_type const&</paramtype> 2602 </parameter> 2603 <type>size_type</type> 2604 <returns> 2605 <para>The index of the bucket which would contain an element with key <code>k</code>.</para> 2606 </returns> 2607 <postconditions> 2608 <para>The return value is less than <code>bucket_count()</code></para> 2609 </postconditions> 2610 </method> 2611 <overloaded-method name="begin"> 2612 <signature> 2613 <parameter name="n"> 2614 <paramtype>size_type</paramtype> 2615 </parameter> 2616 <type>local_iterator</type> 2617 </signature> 2618 <signature cv="const"> 2619 <parameter name="n"> 2620 <paramtype>size_type</paramtype> 2621 </parameter> 2622 <type>const_local_iterator</type> 2623 </signature> 2624 <requires> 2625 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 2626 </requires> 2627 <returns> 2628 <para>A local iterator pointing the first element in the bucket with index <code>n</code>.</para> 2629 </returns> 2630 </overloaded-method> 2631 <overloaded-method name="end"> 2632 <signature> 2633 <parameter name="n"> 2634 <paramtype>size_type</paramtype> 2635 </parameter> 2636 <type>local_iterator</type> 2637 </signature> 2638 <signature cv="const"> 2639 <parameter name="n"> 2640 <paramtype>size_type</paramtype> 2641 </parameter> 2642 <type>const_local_iterator</type> 2643 </signature> 2644 <requires> 2645 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 2646 </requires> 2647 <returns> 2648 <para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 2649 </returns> 2650 </overloaded-method> 2651 <method name="cbegin" cv="const"> 2652 <parameter name="n"> 2653 <paramtype>size_type</paramtype> 2654 </parameter> 2655 <type>const_local_iterator</type> 2656 <requires> 2657 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 2658 </requires> 2659 <returns> 2660 <para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para> 2661 </returns> 2662 </method> 2663 <method name="cend"> 2664 <parameter name="n"> 2665 <paramtype>size_type</paramtype> 2666 </parameter> 2667 <type>const_local_iterator</type> 2668 <requires> 2669 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 2670 </requires> 2671 <returns> 2672 <para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 2673 </returns> 2674 </method> 2675 </method-group> 2676 <method-group name="hash policy"> 2677 <method name="load_factor" cv="const"> 2678 <type>float</type> 2679 <returns> 2680 <para>The average number of elements per bucket.</para> 2681 </returns> 2682 </method> 2683 <method name="max_load_factor" cv="const"> 2684 <type>float</type> 2685 <returns> 2686 <para>Returns the current maximum load factor.</para> 2687 </returns> 2688 </method> 2689 <method name="max_load_factor"> 2690 <parameter name="z"> 2691 <paramtype>float</paramtype> 2692 </parameter> 2693 <type>void</type> 2694 <effects> 2695 <para>Changes the container's maximum load factor, using <code>z</code> as a hint.</para> 2696 </effects> 2697 </method> 2698 <method name="rehash"> 2699 <parameter name="n"> 2700 <paramtype>size_type</paramtype> 2701 </parameter> 2702 <type>void</type> 2703 <description> 2704 <para>Changes the number of buckets so that there at least <code>n</code> buckets, and so that the load factor is less than the maximum load factor.</para> 2705 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 2706 </description> 2707 <throws> 2708 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 2709 </throws> 2710 </method> 2711 <method name="reserve"> 2712 <parameter name="n"> 2713 <paramtype>size_type</paramtype> 2714 </parameter> 2715 <type>void</type> 2716 <description> 2717 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 2718 </description> 2719 <throws> 2720 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 2721 </throws> 2722 </method> 2723 </method-group> 2724 <free-function-group name="Equality Comparisons"> 2725 <function name="operator=="> 2726 <template> 2727 <template-type-parameter name="Value"> 2728 </template-type-parameter> 2729 <template-type-parameter name="Hash"> 2730 </template-type-parameter> 2731 <template-type-parameter name="Pred"> 2732 </template-type-parameter> 2733 <template-type-parameter name="Alloc"> 2734 </template-type-parameter> 2735 </template> 2736 <parameter name="x"> 2737 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc> const&</paramtype> 2738 </parameter> 2739 <parameter name="y"> 2740 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc> const&</paramtype> 2741 </parameter> 2742 <type>bool</type> 2743 <description> 2744 <para>Return <code>true</code> if <code>x.size() == 2745 y.size</code> and for every equivalent key group in 2746 <code>x</code>, there is a group in <code>y</code> 2747 for the same key, which is a permutation (using 2748 <code>operator==</code> to compare the value types). 2749 </para> 2750 </description> 2751 <notes> 2752 <para>The behavior of this function was changed to match 2753 the C++11 standard in Boost 1.48.</para> 2754 <para>Behavior is undefined if the two containers don't have 2755 equivalent equality predicates.</para> 2756 </notes> 2757 </function> 2758 <function name="operator!="> 2759 <template> 2760 <template-type-parameter name="Value"> 2761 </template-type-parameter> 2762 <template-type-parameter name="Hash"> 2763 </template-type-parameter> 2764 <template-type-parameter name="Pred"> 2765 </template-type-parameter> 2766 <template-type-parameter name="Alloc"> 2767 </template-type-parameter> 2768 </template> 2769 <parameter name="x"> 2770 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc> const&</paramtype> 2771 </parameter> 2772 <parameter name="y"> 2773 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc> const&</paramtype> 2774 </parameter> 2775 <type>bool</type> 2776 <description> 2777 <para>Return <code>false</code> if <code>x.size() == 2778 y.size</code> and for every equivalent key group in 2779 <code>x</code>, there is a group in <code>y</code> 2780 for the same key, which is a permutation (using 2781 <code>operator==</code> to compare the value types). 2782 </para> 2783 </description> 2784 <notes> 2785 <para>The behavior of this function was changed to match 2786 the C++11 standard in Boost 1.48.</para> 2787 <para>Behavior is undefined if the two containers don't have 2788 equivalent equality predicates.</para> 2789 </notes> 2790 </function> 2791 </free-function-group> 2792 <free-function-group name="swap"> 2793 <function name="swap"> 2794 <template> 2795 <template-type-parameter name="Value"> 2796 </template-type-parameter> 2797 <template-type-parameter name="Hash"> 2798 </template-type-parameter> 2799 <template-type-parameter name="Pred"> 2800 </template-type-parameter> 2801 <template-type-parameter name="Alloc"> 2802 </template-type-parameter> 2803 </template> 2804 <parameter name="x"> 2805 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc>&</paramtype> 2806 </parameter> 2807 <parameter name="y"> 2808 <paramtype>unordered_multiset<Value, Hash, Pred, Alloc>&</paramtype> 2809 </parameter> 2810 <type>void</type> 2811 <effects> 2812 <para><code>x.swap(y)</code></para> 2813 </effects> 2814 <description> 2815 <para>Swaps the contents of <code>x</code> and <code>y</code>.</para> 2816 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 2817 <code>Allocator::propagate_on_container_swap::value</code> is true then the 2818 containers' allocators are swapped. Otherwise, swapping with unequal allocators 2819 results in undefined behavior.</para> 2820 </description> 2821 <throws> 2822 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 2823 </throws> 2824 <notes> 2825 <para>The exception specifications aren't quite the same as the C++11 standard, as 2826 the equality predieate and hash function are swapped using their copy constructors.</para> 2827 </notes> 2828 </function> 2829 </free-function-group> 2830 </class> 2831 <namespace name="unordered"> 2832 <class name="node_handle_set"> 2833 <template pack="true"> 2834 <template-type-parameter name="ImplementationDefined"/> 2835 </template> 2836 <purpose> 2837 <para> 2838 An object that owns a single element extracted from an 2839 <classname>unordered_set</classname> or an 2840 <classname>unordered_multiset</classname>, that 2841 can then be inserted into a compatible container type. 2842 </para> 2843 <para> 2844 The name and template parameters of this type are implementation 2845 defined, and should be obtained using the <code>node_type</code> 2846 member typedef from the appropriate container. 2847 </para> 2848 </purpose> 2849 <typedef name="value_type"> 2850 <type>typename Container::value_type></type> 2851 </typedef> 2852 <typedef name="allocator_type"> 2853 <type>typename Container::allocator_type></type> 2854 </typedef> 2855 <constructor specifiers="constexpr" cv="noexcept"> 2856 </constructor> 2857 <destructor/> 2858 <constructor cv="noexcept"> 2859 <parameter> 2860 <paramtype>node_handle_set &&</paramtype> 2861 </parameter> 2862 </constructor> 2863 <method name="operator="> 2864 <parameter> 2865 <paramtype>node_handle_set&&</paramtype> 2866 </parameter> 2867 <type>node_handle_set&</type> 2868 </method> 2869 <method name="value" cv="const"> 2870 <type>value_type&</type> 2871 </method> 2872 <method name="get_allocator" cv="const"> 2873 <type>allocator_type</type> 2874 </method> 2875 <method name="operator bool" specifiers="explicit" cv="const noexcept"> 2876 </method> 2877 <method name="empty" cv="const noexcept"> 2878 <type>bool</type> 2879 </method> 2880 <method name="swap" cv="noexcept(ator_traits::propagate_on_container_swap::value)"> 2881 <parameter> 2882 <paramtype>node_handle_set&</paramtype> 2883 </parameter> 2884 <type>void</type> 2885 <notes> 2886 <para> 2887 In C++17 is also <code>noexcept</code> if <code>ator_traits::is_always_equal::value</code> is true. 2888 But we don't support that trait yet. 2889 </para> 2890 </notes> 2891 </method> 2892 <free-function-group name="swap" cv="noexcept(noexcept(x.swap(y)))"> 2893 <function name="swap"> 2894 <template pack="true"> 2895 <template-type-parameter name="ImplementationDefined"/> 2896 </template> 2897 <parameter name="x"> 2898 <paramtype>node_handle_set<ImplementationDefined>&</paramtype> 2899 </parameter> 2900 <parameter name="y"> 2901 <paramtype>node_handle_set<ImplementationDefined>&</paramtype> 2902 </parameter> 2903 <type>void</type> 2904 <effects> 2905 <para><code>x.swap(y)</code></para> 2906 </effects> 2907 </function> 2908 </free-function-group> 2909 </class> 2910 </namespace> 2911 </namespace> 2912 </header> 2913 <header name="boost/unordered_map.hpp"> 2914 <namespace name="boost"> 2915 <class name="unordered_map"> 2916 <template> 2917 <template-type-parameter name="Key"> 2918 </template-type-parameter> 2919 <template-type-parameter name="Mapped"> 2920 </template-type-parameter> 2921 <template-type-parameter name="Hash"> 2922 <default><type>boost::hash<Key></type></default> 2923 </template-type-parameter> 2924 <template-type-parameter name="Pred"> 2925 <default><type>std::equal_to<Key></type></default> 2926 </template-type-parameter> 2927 <template-type-parameter name="Alloc"> 2928 <default><type>std::allocator<std::pair<Key const, Mapped>></type></default> 2929 </template-type-parameter> 2930 </template> 2931 <purpose><simpara> 2932 An unordered associative container that associates unique keys with another value. 2933 </simpara></purpose> 2934 <description> 2935 <para><emphasis role="bold">Template Parameters</emphasis> 2936 <informaltable> 2937 <tgroup cols="2"> 2938 <tbody> 2939 <row> 2940 <entry><emphasis>Key</emphasis></entry> 2941 <entry><code>Key</code> must be <code>Erasable</code> from the container 2942 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 2943 </entry></row> 2944 <row> 2945 <entry><emphasis>Mapped</emphasis></entry> 2946 <entry><code>Mapped</code> must be <code>Erasable</code> from the container 2947 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 2948 </entry></row> 2949 <row> 2950 <entry><emphasis>Hash</emphasis></entry> 2951 <entry>A unary function object type that acts a hash function for a <code>Key</code>. It takes a single argument of type <code>Key</code> and returns a value of type std::size_t.</entry></row> 2952 <row> 2953 <entry><emphasis>Pred</emphasis></entry> 2954 <entry>A binary function object that implements an equivalence relation on values of type <code>Key</code>. 2955 A binary function object that induces an equivalence relation on values of type <code>Key</code>. 2956 It takes two arguments of type <code>Key</code> and returns a value of type bool.</entry></row> 2957 <row> 2958 <entry><emphasis>Alloc</emphasis></entry> 2959 <entry>An allocator whose value type is the same as the container's value type.</entry></row></tbody></tgroup></informaltable></para> 2960 <para>The elements are organized into buckets. Keys with the same hash code are stored in the same bucket.</para> 2961 <para>The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.</para> 2962 </description> 2963 <typedef name="key_type"> 2964 <type>Key</type> 2965 </typedef> 2966 <typedef name="value_type"> 2967 <type>std::pair<Key const, Mapped></type> 2968 </typedef> 2969 <typedef name="mapped_type"> 2970 <type>Mapped</type> 2971 </typedef> 2972 <typedef name="hasher"> 2973 <type>Hash</type> 2974 </typedef> 2975 <typedef name="key_equal"> 2976 <type>Pred</type> 2977 </typedef> 2978 <typedef name="allocator_type"> 2979 <type>Alloc</type> 2980 </typedef> 2981 <typedef name="pointer"> 2982 <type>typename allocator_type::pointer</type> 2983 <description> 2984 <para> 2985 <code>value_type*</code> if 2986 <code>allocator_type::pointer</code> is not defined. 2987 </para> 2988 </description> 2989 </typedef> 2990 <typedef name="const_pointer"> 2991 <type>typename allocator_type::const_pointer</type> 2992 <description> 2993 <para> 2994 <code>boost::pointer_to_other<pointer, value_type>::type</code> 2995 if <code>allocator_type::const_pointer</code> is not defined. 2996 </para> 2997 </description> 2998 </typedef> 2999 <typedef name="reference"> 3000 <type>value_type&</type> 3001 <purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose> 3002 </typedef> 3003 <typedef name="const_reference"> 3004 <type>value_type const&</type> 3005 <purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose> 3006 </typedef> 3007 <typedef name="size_type"> 3008 <type><emphasis>implementation-defined</emphasis></type> 3009 <description> 3010 <para>An unsigned integral type.</para> 3011 <para><type>size_type</type> can represent any non-negative value of <type>difference_type</type>.</para> 3012 </description> 3013 </typedef> 3014 <typedef name="difference_type"> 3015 <type><emphasis>implementation-defined</emphasis></type> 3016 <description> 3017 <para>A signed integral type.</para> 3018 <para>Is identical to the difference type of <type>iterator</type> and <type>const_iterator</type>.</para> 3019 </description> 3020 </typedef> 3021 <typedef name="iterator"> 3022 <type><emphasis>implementation-defined</emphasis></type> 3023 <description> 3024 <para>An iterator whose value type is <type>value_type</type>. </para> 3025 <para>The iterator category is at least a forward iterator.</para> 3026 <para>Convertible to <type>const_iterator</type>.</para> 3027 </description> 3028 </typedef> 3029 <typedef name="const_iterator"> 3030 <type><emphasis>implementation-defined</emphasis></type> 3031 <description> 3032 <para>A constant iterator whose value type is <type>value_type</type>. </para> 3033 <para>The iterator category is at least a forward iterator.</para> 3034 </description> 3035 </typedef> 3036 <typedef name="local_iterator"> 3037 <type><emphasis>implementation-defined</emphasis></type> 3038 <description> 3039 <para>An iterator with the same value type, difference type and pointer and reference type as <type>iterator</type>.</para> 3040 <para>A local_iterator object can be used to iterate through a single bucket.</para> 3041 </description> 3042 </typedef> 3043 <typedef name="const_local_iterator"> 3044 <type><emphasis>implementation-defined</emphasis></type> 3045 <description> 3046 <para>A constant iterator with the same value type, difference type and pointer and reference type as <type>const_iterator</type>.</para> 3047 <para>A const_local_iterator object can be used to iterate through a single bucket.</para> 3048 </description> 3049 </typedef> 3050 <typedef name="node_type"> 3051 <type><emphasis>implementation-defined</emphasis></type> 3052 <description> 3053 <para>See <classname>node_handle_map</classname> for details.</para> 3054 </description> 3055 </typedef> 3056 <typedef name="insert_return_type"> 3057 <type><emphasis>implementation-defined</emphasis></type> 3058 <description> 3059 Structure returned by inserting <code>node_type</code>. 3060 </description> 3061 </typedef> 3062 <constructor> 3063 <postconditions> 3064 <code><methodname>size</methodname>() == 0</code> 3065 </postconditions> 3066 <description> 3067 <para>Constructs an empty container using hasher() as the hash function, key_equal() as the key equality predicate, allocator_type() as the allocator and a maximum load factor of 1.0.</para> 3068 </description> 3069 <requires> 3070 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 3071 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 3072 </para> 3073 </requires> 3074 </constructor> 3075 <constructor specifiers="explicit"> 3076 <parameter name="n"> 3077 <paramtype>size_type</paramtype> 3078 </parameter> 3079 <parameter name="hf"> 3080 <paramtype>hasher const&</paramtype> 3081 <default>hasher()</default> 3082 </parameter> 3083 <parameter name="eq"> 3084 <paramtype>key_equal const&</paramtype> 3085 <default>key_equal()</default> 3086 </parameter> 3087 <parameter name="a"> 3088 <paramtype>allocator_type const&</paramtype> 3089 <default>allocator_type()</default> 3090 </parameter> 3091 <postconditions> 3092 <code><methodname>size</methodname>() == 0</code> 3093 </postconditions> 3094 <description> 3095 <para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para> 3096 </description> 3097 <requires> 3098 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 3099 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 3100 </para> 3101 </requires> 3102 </constructor> 3103 <constructor> 3104 <template> 3105 <template-type-parameter name="InputIterator"> 3106 </template-type-parameter> 3107 </template> 3108 <parameter name="f"> 3109 <paramtype>InputIterator</paramtype> 3110 </parameter> 3111 <parameter name="l"> 3112 <paramtype>InputIterator</paramtype> 3113 </parameter> 3114 <parameter name="n"> 3115 <paramtype>size_type</paramtype> 3116 <default><emphasis>implementation-defined</emphasis></default> 3117 </parameter> 3118 <parameter name="hf"> 3119 <paramtype>hasher const&</paramtype> 3120 <default>hasher()</default> 3121 </parameter> 3122 <parameter name="eq"> 3123 <paramtype>key_equal const&</paramtype> 3124 <default>key_equal()</default> 3125 </parameter> 3126 <parameter name="a"> 3127 <paramtype>allocator_type const&</paramtype> 3128 <default>allocator_type()</default> 3129 </parameter> 3130 <description> 3131 <para>Constructs an empty container with at least <code>n</code> buckets, 3132 using <code>hf</code> as the hash function, 3133 <code>eq</code> as the key equality predicate, 3134 <code>a</code> as the allocator and a maximum load factor of 1.0 3135 and inserts the elements from [f, l) into it. 3136 </para> 3137 </description> 3138 <requires> 3139 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 3140 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 3141 </para> 3142 </requires> 3143 </constructor> 3144 <constructor> 3145 <parameter> 3146 <paramtype>unordered_map const&</paramtype> 3147 </parameter> 3148 <description> 3149 <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para> 3150 <para>If <code>Allocator::select_on_container_copy_construction</code> 3151 exists and has the right signature, the allocator will be 3152 constructed from its result.</para> 3153 </description> 3154 <requires> 3155 <para><code>value_type</code> is copy constructible</para> 3156 </requires> 3157 </constructor> 3158 <constructor> 3159 <parameter> 3160 <paramtype>unordered_map &&</paramtype> 3161 </parameter> 3162 <description> 3163 <para>The move constructor.</para> 3164 </description> 3165 <notes> 3166 <para>This is implemented using Boost.Move.</para> 3167 </notes> 3168 <requires> 3169 <para> 3170 <code>value_type</code> is move constructible. 3171 </para> 3172 <para> 3173 On compilers without rvalue reference support the 3174 emulation does not support moving without calling 3175 <code>boost::move</code> if <code>value_type</code> is 3176 not copyable. So, for example, you can't return the 3177 container from a function. 3178 </para> 3179 </requires> 3180 </constructor> 3181 <constructor specifiers="explicit"> 3182 <parameter name="a"> 3183 <paramtype>Allocator const&</paramtype> 3184 </parameter> 3185 <description> 3186 <para>Constructs an empty container, using allocator <code>a</code>.</para> 3187 </description> 3188 </constructor> 3189 <constructor> 3190 <parameter name="x"> 3191 <paramtype>unordered_map const&</paramtype> 3192 </parameter> 3193 <parameter name="a"> 3194 <paramtype>Allocator const&</paramtype> 3195 </parameter> 3196 <description> 3197 <para>Constructs an container, copying <code>x</code>'s contained elements, hash function, predicate, maximum load factor, but using allocator <code>a</code>.</para> 3198 </description> 3199 </constructor> 3200 <constructor> 3201 <parameter name="x"> 3202 <paramtype>unordered_map &&</paramtype> 3203 </parameter> 3204 <parameter name="a"> 3205 <paramtype>Allocator const&</paramtype> 3206 </parameter> 3207 <description> 3208 <para>Construct a container moving <code>x</code>'s contained elements, and having the hash function, predicate and maximum load factor, but using allocate <code>a</code>.</para> 3209 </description> 3210 <notes> 3211 <para>This is implemented using Boost.Move.</para> 3212 </notes> 3213 <requires> 3214 <para> 3215 <code>value_type</code> is move insertable. 3216 </para> 3217 </requires> 3218 </constructor> 3219 <constructor> 3220 <parameter name="il"> 3221 <paramtype>initializer_list<value_type></paramtype> 3222 </parameter> 3223 <parameter name="n"> 3224 <paramtype>size_type</paramtype> 3225 <default><emphasis>implementation-defined</emphasis></default> 3226 </parameter> 3227 <parameter name="hf"> 3228 <paramtype>hasher const&</paramtype> 3229 <default>hasher()</default> 3230 </parameter> 3231 <parameter name="eq"> 3232 <paramtype>key_equal const&</paramtype> 3233 <default>key_equal()</default> 3234 </parameter> 3235 <parameter name="a"> 3236 <paramtype>allocator_type const&</paramtype> 3237 <default>allocator_type()</default> 3238 </parameter> 3239 <description> 3240 <para>Constructs an empty container with at least <code>n</code> buckets, 3241 using <code>hf</code> as the hash function, 3242 <code>eq</code> as the key equality predicate, 3243 <code>a</code> as the allocator and a maximum load factor of 1.0 3244 and inserts the elements from <code>il</code> into it. 3245 </para> 3246 </description> 3247 <requires> 3248 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 3249 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 3250 </para> 3251 </requires> 3252 </constructor> 3253 <constructor> 3254 <parameter name="n"> 3255 <paramtype>size_type</paramtype> 3256 </parameter> 3257 <parameter name="a"> 3258 <paramtype>allocator_type const&</paramtype> 3259 </parameter> 3260 <postconditions> 3261 <code><methodname>size</methodname>() == 0</code> 3262 </postconditions> 3263 <description> 3264 <para>Constructs an empty container with at least <code>n</code> buckets, 3265 using <code>hf</code> as the hash function, 3266 the default hash function and key equality predicate, 3267 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 3268 </description> 3269 <requires> 3270 <para><code>hasher</code> and <code>key_equal</code> need to be <code>DefaultConstructible</code>. 3271 </para> 3272 </requires> 3273 </constructor> 3274 <constructor> 3275 <parameter name="n"> 3276 <paramtype>size_type</paramtype> 3277 </parameter> 3278 <parameter name="hf"> 3279 <paramtype>hasher const&</paramtype> 3280 </parameter> 3281 <parameter name="a"> 3282 <paramtype>allocator_type const&</paramtype> 3283 </parameter> 3284 <postconditions> 3285 <code><methodname>size</methodname>() == 0</code> 3286 </postconditions> 3287 <description> 3288 <para>Constructs an empty container with at least <code>n</code> buckets, 3289 using <code>hf</code> as the hash function, 3290 the default key equality predicate, 3291 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 3292 </description> 3293 <requires> 3294 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 3295 </para> 3296 </requires> 3297 </constructor> 3298 <constructor> 3299 <template> 3300 <template-type-parameter name="InputIterator"> 3301 </template-type-parameter> 3302 </template> 3303 <parameter name="f"> 3304 <paramtype>InputIterator</paramtype> 3305 </parameter> 3306 <parameter name="l"> 3307 <paramtype>InputIterator</paramtype> 3308 </parameter> 3309 <parameter name="n"> 3310 <paramtype>size_type</paramtype> 3311 </parameter> 3312 <parameter name="a"> 3313 <paramtype>allocator_type const&</paramtype> 3314 </parameter> 3315 <description> 3316 <para>Constructs an empty container with at least <code>n</code> buckets, 3317 using <code>a</code> as the allocator, with the 3318 default hash function and key equality predicate 3319 and a maximum load factor of 1.0 3320 and inserts the elements from [f, l) into it. 3321 </para> 3322 </description> 3323 <requires> 3324 <para><code>hasher</code>, <code>key_equal</code> need to be <code>DefaultConstructible</code>. 3325 </para> 3326 </requires> 3327 </constructor> 3328 <constructor> 3329 <template> 3330 <template-type-parameter name="InputIterator"> 3331 </template-type-parameter> 3332 </template> 3333 <parameter name="f"> 3334 <paramtype>InputIterator</paramtype> 3335 </parameter> 3336 <parameter name="l"> 3337 <paramtype>InputIterator</paramtype> 3338 </parameter> 3339 <parameter name="n"> 3340 <paramtype>size_type</paramtype> 3341 </parameter> 3342 <parameter name="hf"> 3343 <paramtype>hasher const&</paramtype> 3344 </parameter> 3345 <parameter name="a"> 3346 <paramtype>allocator_type const&</paramtype> 3347 </parameter> 3348 <description> 3349 <para>Constructs an empty container with at least <code>n</code> buckets, 3350 using <code>hf</code> as the hash function, 3351 <code>a</code> as the allocator, with the 3352 default key equality predicate 3353 and a maximum load factor of 1.0 3354 and inserts the elements from [f, l) into it. 3355 </para> 3356 </description> 3357 <requires> 3358 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 3359 </para> 3360 </requires> 3361 </constructor> 3362 <destructor> 3363 <notes> 3364 <para>The destructor is applied to every element, and all memory is deallocated</para> 3365 </notes> 3366 </destructor> 3367 <method name="operator="> 3368 <parameter> 3369 <paramtype>unordered_map const&</paramtype> 3370 </parameter> 3371 <type>unordered_map&</type> 3372 <description> 3373 <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para> 3374 <para>If <code>Alloc::propagate_on_container_copy_assignment</code> 3375 exists and <code>Alloc::propagate_on_container_copy_assignment::value 3376 </code> is true, the allocator is overwritten, if not the 3377 copied elements are created using the existing 3378 allocator.</para> 3379 </description> 3380 <requires> 3381 <para><code>value_type</code> is copy constructible</para> 3382 </requires> 3383 </method> 3384 <method name="operator="> 3385 <parameter> 3386 <paramtype>unordered_map &&</paramtype> 3387 </parameter> 3388 <type>unordered_map&</type> 3389 <description> 3390 <para>The move assignment operator.</para> 3391 <para>If <code>Alloc::propagate_on_container_move_assignment</code> 3392 exists and <code>Alloc::propagate_on_container_move_assignment::value 3393 </code> is true, the allocator is overwritten, if not the 3394 moved elements are created using the existing 3395 allocator.</para> 3396 </description> 3397 <notes> 3398 <para> 3399 On compilers without rvalue references, this is emulated using 3400 Boost.Move. Note that on some compilers the copy assignment 3401 operator may be used in some circumstances. 3402 </para> 3403 </notes> 3404 <requires> 3405 <para> 3406 <code>value_type</code> is move constructible. 3407 </para> 3408 </requires> 3409 </method> 3410 <method name="operator="> 3411 <parameter> 3412 <paramtype>initializer_list<value_type></paramtype> 3413 </parameter> 3414 <type>unordered_map&</type> 3415 <description> 3416 <para>Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed.</para> 3417 </description> 3418 <requires> 3419 <para> 3420 <code>value_type</code> is <code>CopyInsertable</code> into the container and 3421 <code>CopyAssignable</code>. 3422 </para> 3423 </requires> 3424 </method> 3425 <method name="get_allocator" cv="const"> 3426 <type>allocator_type</type> 3427 </method> 3428 <method-group name="size and capacity"> 3429 <method name="empty" cv="const"> 3430 <type>bool</type> 3431 <returns> 3432 <code><methodname>size</methodname>() == 0</code> 3433 </returns> 3434 </method> 3435 <method name="size" cv="const"> 3436 <type>size_type</type> 3437 <returns> 3438 <code>std::distance(<methodname>begin</methodname>(), <methodname>end</methodname>())</code> 3439 </returns> 3440 </method> 3441 <method name="max_size" cv="const"> 3442 <type>size_type</type> 3443 <returns><code><methodname>size</methodname>()</code> of the largest possible container. 3444 </returns> 3445 </method> 3446 </method-group> 3447 <method-group name="iterators"> 3448 <overloaded-method name="begin"> 3449 <signature><type>iterator</type></signature> 3450 <signature cv="const"><type>const_iterator</type></signature> 3451 <returns>An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 3452 </returns> 3453 </overloaded-method> 3454 <overloaded-method name="end"> 3455 <signature> 3456 <type>iterator</type> 3457 </signature> 3458 <signature cv="const"> 3459 <type>const_iterator</type> 3460 </signature> 3461 <returns>An iterator which refers to the past-the-end value for the container. 3462 </returns> 3463 </overloaded-method> 3464 <method name="cbegin" cv="const"> 3465 <type>const_iterator</type> 3466 <returns>A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 3467 </returns> 3468 </method> 3469 <method name="cend" cv="const"> 3470 <type>const_iterator</type> 3471 <returns>A constant iterator which refers to the past-the-end value for the container. 3472 </returns> 3473 </method> 3474 </method-group> 3475 <method-group name="modifiers"> 3476 <method name="emplace"> 3477 <template> 3478 <template-type-parameter name="Args" pack="1"> 3479 </template-type-parameter> 3480 </template> 3481 <parameter name="args" pack="1"> 3482 <paramtype>Args&&</paramtype> 3483 </parameter> 3484 <type>std::pair<iterator, bool></type> 3485 <description> 3486 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container if and only if there is no element in the container with an equivalent key.</para> 3487 </description> 3488 <requires> 3489 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 3490 <code>X</code> from <code>args</code>. 3491 </para> 3492 </requires> 3493 <returns> 3494 <para>The bool component of the return type is true if an insert took place.</para> 3495 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3496 </returns> 3497 <throws> 3498 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3499 </throws> 3500 <notes> 3501 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3502 <para>Pointers and references to elements are never invalidated.</para> 3503 <para>If the compiler doesn't support variadic template arguments or rvalue 3504 references, this is emulated for up to 10 arguments, with no support 3505 for rvalue references or move semantics.</para> 3506 <para>Since existing <code>std::pair</code> implementations don't support 3507 <code>std::piecewise_construct</code> this emulates it, 3508 but using <code>boost::unordered::piecewise_construct</code>.</para> 3509 </notes> 3510 </method> 3511 <method name="emplace_hint"> 3512 <template> 3513 <template-type-parameter name="Args" pack="1"> 3514 </template-type-parameter> 3515 </template> 3516 <parameter name="hint"> 3517 <paramtype>const_iterator</paramtype> 3518 </parameter> 3519 <parameter name="args" pack="1"> 3520 <paramtype>Args&&</paramtype> 3521 </parameter> 3522 <type>iterator</type> 3523 <description> 3524 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container if and only if there is no element in the container with an equivalent key.</para> 3525 <para><code>hint</code> is a suggestion to where the element should be inserted.</para> 3526 </description> 3527 <requires> 3528 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 3529 <code>X</code> from <code>args</code>. 3530 </para> 3531 </requires> 3532 <returns> 3533 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3534 </returns> 3535 <throws> 3536 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3537 </throws> 3538 <notes> 3539 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 3540 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3541 <para>Pointers and references to elements are never invalidated.</para> 3542 <para>If the compiler doesn't support variadic template arguments or rvalue 3543 references, this is emulated for up to 10 arguments, with no support 3544 for rvalue references or move semantics.</para> 3545 <para>Since existing <code>std::pair</code> implementations don't support 3546 <code>std::piecewise_construct</code> this emulates it, 3547 but using <code>boost::unordered::piecewise_construct</code>.</para> 3548 </notes> 3549 </method> 3550 <method name="insert"> 3551 <parameter name="obj"> 3552 <paramtype>value_type const&</paramtype> 3553 </parameter> 3554 <type>std::pair<iterator, bool></type> 3555 <description> 3556 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent key.</para> 3557 </description> 3558 <requires> 3559 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 3560 </requires> 3561 <returns> 3562 <para>The bool component of the return type is true if an insert took place.</para> 3563 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3564 </returns> 3565 <throws> 3566 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3567 </throws> 3568 <notes> 3569 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3570 <para>Pointers and references to elements are never invalidated.</para> 3571 </notes> 3572 </method> 3573 <method name="insert"> 3574 <parameter name="obj"> 3575 <paramtype>value_type&&</paramtype> 3576 </parameter> 3577 <type>std::pair<iterator, bool></type> 3578 <description> 3579 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent key.</para> 3580 </description> 3581 <requires> 3582 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 3583 </requires> 3584 <returns> 3585 <para>The bool component of the return type is true if an insert took place.</para> 3586 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3587 </returns> 3588 <throws> 3589 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3590 </throws> 3591 <notes> 3592 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3593 <para>Pointers and references to elements are never invalidated.</para> 3594 </notes> 3595 </method> 3596 <method name="insert"> 3597 <parameter name="hint"> 3598 <paramtype>const_iterator</paramtype> 3599 </parameter> 3600 <parameter name="obj"> 3601 <paramtype>value_type const&</paramtype> 3602 </parameter> 3603 <type>iterator</type> 3604 <description> 3605 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent key.</para> 3606 <para>hint is a suggestion to where the element should be inserted.</para> 3607 </description> 3608 <requires> 3609 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 3610 </requires> 3611 <returns> 3612 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3613 </returns> 3614 <throws> 3615 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3616 </throws> 3617 <notes> 3618 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 3619 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3620 <para>Pointers and references to elements are never invalidated.</para> 3621 </notes> 3622 </method> 3623 <method name="insert"> 3624 <parameter name="hint"> 3625 <paramtype>const_iterator</paramtype> 3626 </parameter> 3627 <parameter name="obj"> 3628 <paramtype>value_type&&</paramtype> 3629 </parameter> 3630 <type>iterator</type> 3631 <description> 3632 <para>Inserts <code>obj</code> in the container if and only if there is no element in the container with an equivalent key.</para> 3633 <para>hint is a suggestion to where the element should be inserted.</para> 3634 </description> 3635 <requires> 3636 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 3637 </requires> 3638 <returns> 3639 <para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para> 3640 </returns> 3641 <throws> 3642 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3643 </throws> 3644 <notes> 3645 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 3646 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3647 <para>Pointers and references to elements are never invalidated.</para> 3648 </notes> 3649 </method> 3650 <method name="insert"> 3651 <template> 3652 <template-type-parameter name="InputIterator"> 3653 </template-type-parameter> 3654 </template> 3655 <parameter name="first"> 3656 <paramtype>InputIterator</paramtype> 3657 </parameter> 3658 <parameter name="last"> 3659 <paramtype>InputIterator</paramtype> 3660 </parameter> 3661 <type>void</type> 3662 <description> 3663 <para>Inserts a range of elements into the container. 3664 Elements are inserted if and only if there is no element in the container with an equivalent key. 3665 </para> 3666 </description> 3667 <requires> 3668 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 3669 <code>X</code> from <code>*first</code>.</para> 3670 </requires> 3671 <throws> 3672 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3673 </throws> 3674 <notes> 3675 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3676 <para>Pointers and references to elements are never invalidated.</para> 3677 </notes> 3678 </method> 3679 <method name="insert"> 3680 <parameter name="il"> 3681 <paramtype>initializer_list<value_type></paramtype> 3682 </parameter> 3683 <type>void</type> 3684 <description> 3685 <para>Inserts a range of elements into the container. 3686 Elements are inserted if and only if there is no element in the container with an equivalent key. 3687 </para> 3688 </description> 3689 <requires> 3690 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 3691 <code>X</code> from <code>*first</code>.</para> 3692 </requires> 3693 <throws> 3694 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3695 </throws> 3696 <notes> 3697 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3698 <para>Pointers and references to elements are never invalidated.</para> 3699 </notes> 3700 </method> 3701 <method name="insert"> 3702 <parameter name="il"> 3703 <paramtype>initializer_list<value_type></paramtype> 3704 </parameter> 3705 <type>void</type> 3706 <description> 3707 <para>Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key.</para> 3708 </description> 3709 <requires> 3710 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 3711 <code>X</code> from <code>*first</code>.</para> 3712 </requires> 3713 <throws> 3714 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3715 </throws> 3716 <notes> 3717 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3718 <para>Pointers and references to elements are never invalidated.</para> 3719 </notes> 3720 </method> 3721 <method name="extract"> 3722 <parameter name="position"> 3723 <paramtype>const_iterator</paramtype> 3724 </parameter> 3725 <type>node_type</type> 3726 <description> 3727 <para>Removes the element pointed to by <code>position</code>.</para> 3728 </description> 3729 <returns> 3730 <para>A <code>node_type</code> owning the element.</para> 3731 </returns> 3732 <notes> 3733 <para> 3734 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_multimap</code>, 3735 but that is not supported yet. 3736 </para> 3737 </notes> 3738 </method> 3739 <method name="extract"> 3740 <parameter name="k"> 3741 <paramtype>key_type const&</paramtype> 3742 </parameter> 3743 <type>node_type</type> 3744 <description> 3745 <para>Removes an element with key equivalent to <code>k</code>.</para> 3746 </description> 3747 <returns> 3748 <para>A <code>node_type</code> owning the element if found, otherwise an empty <code>node_type</code>.</para> 3749 </returns> 3750 <throws> 3751 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3752 </throws> 3753 <notes> 3754 <para> 3755 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_multimap</code>, 3756 but that is not supported yet. 3757 </para> 3758 </notes> 3759 </method> 3760 <method name="insert"> 3761 <parameter name="nh"> 3762 <paramtype>node_type&&</paramtype> 3763 </parameter> 3764 <type>insert_return_type</type> 3765 <description> 3766 <para>If <code>nh</code> is empty, has no affect.</para> 3767 <para>Otherwise inserts the element owned by <code>nh</code> 3768 if and only if there is no element in the container with an equivalent key. 3769 </para> 3770 </description> 3771 <requires> 3772 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 3773 </requires> 3774 <returns> 3775 <para>If <code>nh</code> was empty, returns an <code>insert_return_type</code> with: 3776 <code>inserted</code> equal to <code>false</code>, 3777 <code>position</code> equal to <code>end()</code> and 3778 <code>node</code> empty.</para> 3779 <para>Otherwise if there was already an element with an equivalent key, returns an <code>insert_return_type</code> with: 3780 <code>inserted</code> equal to <code>false</code>, 3781 <code>position</code> pointing to a matching element and 3782 <code>node</code> contains the node from <code>nh</code>.</para> 3783 <para>Otherwise if the insertion succeeded, returns an <code>insert_return_type</code> with: 3784 <code>inserted</code> equal to <code>true</code>, 3785 <code>position</code> pointing to the newly inserted element and 3786 <code>node</code> empty.</para> 3787 </returns> 3788 <throws> 3789 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3790 </throws> 3791 <notes> 3792 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3793 <para>Pointers and references to elements are never invalidated.</para> 3794 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_multimap</code>, 3795 but that is not supported yet.</para> 3796 </notes> 3797 </method> 3798 <method name="insert"> 3799 <parameter name="hint"> 3800 <paramtype>const_iterator</paramtype> 3801 </parameter> 3802 <parameter name="nh"> 3803 <paramtype>node_type&&</paramtype> 3804 </parameter> 3805 <type>iterator</type> 3806 <description> 3807 <para>If <code>nh</code> is empty, has no affect.</para> 3808 <para>Otherwise inserts the element owned by <code>nh</code> 3809 if and only if there is no element in the container with an equivalent key. 3810 </para> 3811 <para>If there is already an element in the container with an equivalent key has no effect on <code>nh</code> (i.e. <code>nh</code> still contains the node.)</para> 3812 <para>hint is a suggestion to where the element should be inserted.</para> 3813 </description> 3814 <requires> 3815 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 3816 </requires> 3817 <returns> 3818 <para>If <code>nh</code> was empty returns <code>end()</code>.</para> 3819 <para>If there was already an element in the container with an equivalent key returns an iterator pointing to that.</para> 3820 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 3821 </returns> 3822 <throws> 3823 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 3824 </throws> 3825 <notes> 3826 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 3827 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 3828 <para>Pointers and references to elements are never invalidated.</para> 3829 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_multimap</code>, 3830 but that is not supported yet.</para> 3831 </notes> 3832 </method> 3833 <method name="erase"> 3834 <parameter name="position"> 3835 <paramtype>const_iterator</paramtype> 3836 </parameter> 3837 <type>iterator</type> 3838 <description> 3839 <para>Erase the element pointed to by <code>position</code>.</para> 3840 </description> 3841 <returns> 3842 <para>The iterator following <code>position</code> before the erasure.</para> 3843 </returns> 3844 <throws> 3845 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3846 </throws> 3847 <notes> 3848 <para> 3849 In older versions this could be inefficient because it had to search 3850 through several buckets to find the position of the returned iterator. 3851 The data structure has been changed so that this is no longer the case, 3852 and the alternative erase methods have been deprecated. 3853 </para> 3854 </notes> 3855 </method> 3856 <method name="erase"> 3857 <parameter name="k"> 3858 <paramtype>key_type const&</paramtype> 3859 </parameter> 3860 <type>size_type</type> 3861 <description> 3862 <para>Erase all elements with key equivalent to <code>k</code>.</para> 3863 </description> 3864 <returns> 3865 <para>The number of elements erased.</para> 3866 </returns> 3867 <throws> 3868 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3869 </throws> 3870 </method> 3871 <method name="erase"> 3872 <parameter name="first"> 3873 <paramtype>const_iterator</paramtype> 3874 </parameter> 3875 <parameter name="last"> 3876 <paramtype>const_iterator</paramtype> 3877 </parameter> 3878 <type>iterator</type> 3879 <description> 3880 <para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para> 3881 </description> 3882 <returns> 3883 <para>The iterator following the erased elements - i.e. <code>last</code>.</para> 3884 </returns> 3885 <throws> 3886 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3887 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 3888 </throws> 3889 </method> 3890 <method name="quick_erase"> 3891 <parameter name="position"> 3892 <paramtype>const_iterator</paramtype> 3893 </parameter> 3894 <type>void</type> 3895 <description> 3896 <para>Erase the element pointed to by <code>position</code>.</para> 3897 </description> 3898 <throws> 3899 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3900 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 3901 </throws> 3902 <notes> 3903 <para> 3904 This method was implemented because returning an iterator to 3905 the next element from <code>erase</code> was expensive, but 3906 the container has been redesigned so that is no longer the 3907 case. So this method is now deprecated. 3908 </para> 3909 </notes> 3910 </method> 3911 <method name="erase_return_void"> 3912 <parameter name="position"> 3913 <paramtype>const_iterator</paramtype> 3914 </parameter> 3915 <type>void</type> 3916 <description> 3917 <para>Erase the element pointed to by <code>position</code>.</para> 3918 </description> 3919 <throws> 3920 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 3921 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 3922 </throws> 3923 <notes> 3924 <para> 3925 This method was implemented because returning an iterator to 3926 the next element from <code>erase</code> was expensive, but 3927 the container has been redesigned so that is no longer the 3928 case. So this method is now deprecated. 3929 </para> 3930 </notes> 3931 </method> 3932 <method name="clear"> 3933 <type>void</type> 3934 <description> 3935 <para>Erases all elements in the container.</para> 3936 </description> 3937 <postconditions> 3938 <para><code><methodname>size</methodname>() == 0</code></para> 3939 </postconditions> 3940 <throws> 3941 <para>Never throws an exception.</para> 3942 </throws> 3943 </method> 3944 <method name="swap"> 3945 <parameter> 3946 <paramtype>unordered_map&</paramtype> 3947 </parameter> 3948 <type>void</type> 3949 <description> 3950 <para>Swaps the contents of the container with the parameter.</para> 3951 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 3952 <code>Allocator::propagate_on_container_swap::value</code> is true then the 3953 containers' allocators are swapped. Otherwise, swapping with unequal allocators 3954 results in undefined behavior.</para> 3955 </description> 3956 <throws> 3957 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 3958 </throws> 3959 <notes> 3960 <para>The exception specifications aren't quite the same as the C++11 standard, as 3961 the equality predieate and hash function are swapped using their copy constructors.</para> 3962 </notes> 3963 </method> 3964 <method name="merge"> 3965 <template> 3966 <template-type-parameter name="H2"> 3967 </template-type-parameter> 3968 <template-type-parameter name="P2"> 3969 </template-type-parameter> 3970 </template> 3971 <parameter name="source"> 3972 <paramtype>unordered_map<Key, Mapped, H2, P2, Alloc>&</paramtype> 3973 </parameter> 3974 <notes> 3975 <para>Does not support merging with a compatible <code>unordered_multimap</code> yet.</para> 3976 </notes> 3977 </method> 3978 <method name="merge"> 3979 <template> 3980 <template-type-parameter name="H2"> 3981 </template-type-parameter> 3982 <template-type-parameter name="P2"> 3983 </template-type-parameter> 3984 </template> 3985 <parameter name="source"> 3986 <paramtype>unordered_map<Key, Mapped, H2, P2, Alloc>&&</paramtype> 3987 </parameter> 3988 <notes> 3989 <para>Does not support merging with a compatible <code>unordered_multimap</code> yet.</para> 3990 </notes> 3991 </method> 3992 </method-group> 3993 <method-group name="observers"> 3994 <method name="hash_function" cv="const"> 3995 <type>hasher</type> 3996 <returns>The container's hash function. 3997 </returns> 3998 </method> 3999 <method name="key_eq" cv="const"> 4000 <type>key_equal</type> 4001 <returns>The container's key equality predicate. 4002 </returns> 4003 </method> 4004 </method-group> 4005 <method-group name="lookup"> 4006 <overloaded-method name="find"> 4007 <signature> 4008 <parameter name="k"> 4009 <paramtype>key_type const&</paramtype> 4010 </parameter> 4011 <type>iterator</type> 4012 </signature> 4013 <signature cv="const"> 4014 <parameter name="k"> 4015 <paramtype>key_type const&</paramtype> 4016 </parameter> 4017 <type>const_iterator</type> 4018 </signature> 4019 <signature> 4020 <template> 4021 <template-type-parameter name="CompatibleKey"/> 4022 <template-type-parameter name="CompatibleHash"/> 4023 <template-type-parameter name="CompatiblePredicate"/> 4024 </template> 4025 <parameter name="k"> 4026 <paramtype>CompatibleKey const&</paramtype> 4027 </parameter> 4028 <parameter name="hash"> 4029 <paramtype>CompatibleHash const&</paramtype> 4030 </parameter> 4031 <parameter name="eq"> 4032 <paramtype>CompatiblePredicate const&</paramtype> 4033 </parameter> 4034 <type>iterator</type> 4035 </signature> 4036 <signature cv="const"> 4037 <template> 4038 <template-type-parameter name="CompatibleKey"/> 4039 <template-type-parameter name="CompatibleHash"/> 4040 <template-type-parameter name="CompatiblePredicate"/> 4041 </template> 4042 <parameter name="k"> 4043 <paramtype>CompatibleKey const&</paramtype> 4044 </parameter> 4045 <parameter name="hash"> 4046 <paramtype>CompatibleHash const&</paramtype> 4047 </parameter> 4048 <parameter name="eq"> 4049 <paramtype>CompatiblePredicate const&</paramtype> 4050 </parameter> 4051 <type>const_iterator</type> 4052 </signature> 4053 <returns> 4054 <para>An iterator pointing to an element with key equivalent to <code>k</code>, or <code>b.end()</code> if no such element exists.</para> 4055 </returns> 4056 <notes><para> 4057 The templated overloads are a non-standard extensions which 4058 allows you to use a compatible hash function and equality 4059 predicate for a key of a different type in order to avoid 4060 an expensive type cast. In general, its use is not encouraged. 4061 </para></notes> 4062 </overloaded-method> 4063 <method name="count" cv="const"> 4064 <parameter name="k"> 4065 <paramtype>key_type const&</paramtype> 4066 </parameter> 4067 <type>size_type</type> 4068 <returns> 4069 <para>The number of elements with key equivalent to <code>k</code>.</para> 4070 </returns> 4071 </method> 4072 <overloaded-method name="equal_range"> 4073 <signature> 4074 <parameter name="k"> 4075 <paramtype>key_type const&</paramtype> 4076 </parameter> 4077 <type>std::pair<iterator, iterator></type> 4078 </signature> 4079 <signature cv="const"> 4080 <parameter name="k"> 4081 <paramtype>key_type const&</paramtype> 4082 </parameter> 4083 <type>std::pair<const_iterator, const_iterator></type> 4084 </signature> 4085 <returns> 4086 <para>A range containing all elements with key equivalent to <code>k</code>. 4087 If the container doesn't container any such elements, returns 4088 <code><functionname>std::make_pair</functionname>(<methodname>b.end</methodname>(),<methodname>b.end</methodname>())</code>. 4089 </para> 4090 </returns> 4091 </overloaded-method> 4092 <method name="operator[]"> 4093 <parameter name="k"> 4094 <paramtype>key_type const&</paramtype> 4095 </parameter> 4096 <type>mapped_type&</type> 4097 <effects> 4098 <para>If the container does not already contain an elements with a key equivalent to <code>k</code>, inserts the value <code>std::pair<key_type const, mapped_type>(k, mapped_type())</code></para> 4099 </effects> 4100 <returns> 4101 <para>A reference to <code>x.second</code> where x is the element already in the container, or the newly inserted element with a key equivalent to <code>k</code></para> 4102 </returns> 4103 <throws> 4104 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 4105 </throws> 4106 <notes> 4107 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 4108 <para>Pointers and references to elements are never invalidated.</para> 4109 </notes> 4110 </method> 4111 <overloaded-method name="at"> 4112 <signature><type>Mapped&</type> 4113 <parameter name="k"><paramtype>key_type const&</paramtype></parameter></signature> 4114 <signature cv="const"><type>Mapped const&</type> 4115 <parameter name="k"><paramtype>key_type const&</paramtype></parameter></signature> 4116 <returns> 4117 <para>A reference to <code>x.second</code> where <code>x</code> is the (unique) element whose key is equivalent to <code>k</code>.</para> 4118 </returns> 4119 <throws> 4120 <para>An exception object of type <code>std::out_of_range</code> if no such element is present.</para> 4121 </throws> 4122 </overloaded-method> 4123 </method-group> 4124 <method-group name="bucket interface"> 4125 <method name="bucket_count" cv="const"> 4126 <type>size_type</type> 4127 <returns> 4128 <para>The number of buckets.</para> 4129 </returns> 4130 </method> 4131 <method name="max_bucket_count" cv="const"> 4132 <type>size_type</type> 4133 <returns> 4134 <para>An upper bound on the number of buckets.</para> 4135 </returns> 4136 </method> 4137 <method name="bucket_size" cv="const"> 4138 <parameter name="n"> 4139 <paramtype>size_type</paramtype> 4140 </parameter> 4141 <type>size_type</type> 4142 <requires> 4143 <para><code>n < <methodname>bucket_count</methodname>()</code></para> 4144 </requires> 4145 <returns> 4146 <para>The number of elements in bucket <code>n</code>.</para> 4147 </returns> 4148 </method> 4149 <method name="bucket" cv="const"> 4150 <parameter name="k"> 4151 <paramtype>key_type const&</paramtype> 4152 </parameter> 4153 <type>size_type</type> 4154 <returns> 4155 <para>The index of the bucket which would contain an element with key <code>k</code>.</para> 4156 </returns> 4157 <postconditions> 4158 <para>The return value is less than <code>bucket_count()</code></para> 4159 </postconditions> 4160 </method> 4161 <overloaded-method name="begin"> 4162 <signature> 4163 <parameter name="n"> 4164 <paramtype>size_type</paramtype> 4165 </parameter> 4166 <type>local_iterator</type> 4167 </signature> 4168 <signature cv="const"> 4169 <parameter name="n"> 4170 <paramtype>size_type</paramtype> 4171 </parameter> 4172 <type>const_local_iterator</type> 4173 </signature> 4174 <requires> 4175 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 4176 </requires> 4177 <returns> 4178 <para>A local iterator pointing the first element in the bucket with index <code>n</code>.</para> 4179 </returns> 4180 </overloaded-method> 4181 <overloaded-method name="end"> 4182 <signature> 4183 <parameter name="n"> 4184 <paramtype>size_type</paramtype> 4185 </parameter> 4186 <type>local_iterator</type> 4187 </signature> 4188 <signature cv="const"> 4189 <parameter name="n"> 4190 <paramtype>size_type</paramtype> 4191 </parameter> 4192 <type>const_local_iterator</type> 4193 </signature> 4194 <requires> 4195 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 4196 </requires> 4197 <returns> 4198 <para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 4199 </returns> 4200 </overloaded-method> 4201 <method name="cbegin" cv="const"> 4202 <parameter name="n"> 4203 <paramtype>size_type</paramtype> 4204 </parameter> 4205 <type>const_local_iterator</type> 4206 <requires> 4207 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 4208 </requires> 4209 <returns> 4210 <para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para> 4211 </returns> 4212 </method> 4213 <method name="cend"> 4214 <parameter name="n"> 4215 <paramtype>size_type</paramtype> 4216 </parameter> 4217 <type>const_local_iterator</type> 4218 <requires> 4219 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 4220 </requires> 4221 <returns> 4222 <para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 4223 </returns> 4224 </method> 4225 </method-group> 4226 <method-group name="hash policy"> 4227 <method name="load_factor" cv="const"> 4228 <type>float</type> 4229 <returns> 4230 <para>The average number of elements per bucket.</para> 4231 </returns> 4232 </method> 4233 <method name="max_load_factor" cv="const"> 4234 <type>float</type> 4235 <returns> 4236 <para>Returns the current maximum load factor.</para> 4237 </returns> 4238 </method> 4239 <method name="max_load_factor"> 4240 <parameter name="z"> 4241 <paramtype>float</paramtype> 4242 </parameter> 4243 <type>void</type> 4244 <effects> 4245 <para>Changes the container's maximum load factor, using <code>z</code> as a hint.</para> 4246 </effects> 4247 </method> 4248 <method name="rehash"> 4249 <parameter name="n"> 4250 <paramtype>size_type</paramtype> 4251 </parameter> 4252 <type>void</type> 4253 <description> 4254 <para>Changes the number of buckets so that there at least <code>n</code> buckets, and so that the load factor is less than the maximum load factor.</para> 4255 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 4256 </description> 4257 <throws> 4258 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 4259 </throws> 4260 </method> 4261 <method name="reserve"> 4262 <parameter name="n"> 4263 <paramtype>size_type</paramtype> 4264 </parameter> 4265 <type>void</type> 4266 <description> 4267 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 4268 </description> 4269 <throws> 4270 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 4271 </throws> 4272 </method> 4273 </method-group> 4274 <free-function-group name="Equality Comparisons"> 4275 <function name="operator=="> 4276 <template> 4277 <template-type-parameter name="Key"> 4278 </template-type-parameter> 4279 <template-type-parameter name="Mapped"> 4280 </template-type-parameter> 4281 <template-type-parameter name="Hash"> 4282 </template-type-parameter> 4283 <template-type-parameter name="Pred"> 4284 </template-type-parameter> 4285 <template-type-parameter name="Alloc"> 4286 </template-type-parameter> 4287 </template> 4288 <parameter name="x"> 4289 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 4290 </parameter> 4291 <parameter name="y"> 4292 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 4293 </parameter> 4294 <type>bool</type> 4295 <description> 4296 <para>Return <code>true</code> if <code>x.size() == 4297 y.size</code> and for every element in <code>x</code>, 4298 there is an element in <code>y</code> with the same 4299 for the same key, with an equal value (using 4300 <code>operator==</code> to compare the value types). 4301 </para> 4302 </description> 4303 <notes> 4304 <para>The behavior of this function was changed to match 4305 the C++11 standard in Boost 1.48.</para> 4306 <para>Behavior is undefined if the two containers don't have 4307 equivalent equality predicates.</para> 4308 </notes> 4309 </function> 4310 <function name="operator!="> 4311 <template> 4312 <template-type-parameter name="Key"> 4313 </template-type-parameter> 4314 <template-type-parameter name="Mapped"> 4315 </template-type-parameter> 4316 <template-type-parameter name="Hash"> 4317 </template-type-parameter> 4318 <template-type-parameter name="Pred"> 4319 </template-type-parameter> 4320 <template-type-parameter name="Alloc"> 4321 </template-type-parameter> 4322 </template> 4323 <parameter name="x"> 4324 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 4325 </parameter> 4326 <parameter name="y"> 4327 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 4328 </parameter> 4329 <type>bool</type> 4330 <description> 4331 <para>Return <code>false</code> if <code>x.size() == 4332 y.size</code> and for every element in <code>x</code>, 4333 there is an element in <code>y</code> with the same 4334 for the same key, with an equal value (using 4335 <code>operator==</code> to compare the value types). 4336 </para> 4337 </description> 4338 <notes> 4339 <para>The behavior of this function was changed to match 4340 the C++11 standard in Boost 1.48.</para> 4341 <para>Behavior is undefined if the two containers don't have 4342 equivalent equality predicates.</para> 4343 </notes> 4344 </function> 4345 </free-function-group> 4346 <free-function-group name="swap"> 4347 <function name="swap"> 4348 <template> 4349 <template-type-parameter name="Key"> 4350 </template-type-parameter> 4351 <template-type-parameter name="Mapped"> 4352 </template-type-parameter> 4353 <template-type-parameter name="Hash"> 4354 </template-type-parameter> 4355 <template-type-parameter name="Pred"> 4356 </template-type-parameter> 4357 <template-type-parameter name="Alloc"> 4358 </template-type-parameter> 4359 </template> 4360 <parameter name="x"> 4361 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc>&</paramtype> 4362 </parameter> 4363 <parameter name="y"> 4364 <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc>&</paramtype> 4365 </parameter> 4366 <type>void</type> 4367 <effects> 4368 <para><code>x.swap(y)</code></para> 4369 </effects> 4370 <description> 4371 <para>Swaps the contents of <code>x</code> and <code>y</code>.</para> 4372 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 4373 <code>Allocator::propagate_on_container_swap::value</code> is true then the 4374 containers' allocators are swapped. Otherwise, swapping with unequal allocators 4375 results in undefined behavior.</para> 4376 </description> 4377 <throws> 4378 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 4379 </throws> 4380 <notes> 4381 <para>The exception specifications aren't quite the same as the C++11 standard, as 4382 the equality predieate and hash function are swapped using their copy constructors.</para> 4383 </notes> 4384 </function> 4385 </free-function-group> 4386 </class> 4387 <class name="unordered_multimap"> 4388 <template> 4389 <template-type-parameter name="Key"> 4390 </template-type-parameter> 4391 <template-type-parameter name="Mapped"> 4392 </template-type-parameter> 4393 <template-type-parameter name="Hash"> 4394 <default><type>boost::hash<Key></type></default> 4395 </template-type-parameter> 4396 <template-type-parameter name="Pred"> 4397 <default><type>std::equal_to<Key></type></default> 4398 </template-type-parameter> 4399 <template-type-parameter name="Alloc"> 4400 <default><type>std::allocator<std::pair<Key const, Mapped>></type></default> 4401 </template-type-parameter> 4402 </template> 4403 <purpose><simpara> 4404 An unordered associative container that associates keys with another value. The same key can be stored multiple times. 4405 </simpara></purpose> 4406 <description> 4407 <para><emphasis role="bold">Template Parameters</emphasis> 4408 <informaltable> 4409 <tgroup cols="2"> 4410 <tbody> 4411 <row> 4412 <entry><emphasis>Key</emphasis></entry> 4413 <entry><code>Key</code> must be <code>Erasable</code> from the container 4414 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 4415 </entry></row> 4416 <row> 4417 <entry><emphasis>Mapped</emphasis></entry> 4418 <entry><code>Mapped</code> must be <code>Erasable</code> from the container 4419 (i.e. <code>allocator_traits</code> can <code>destroy</code> it). 4420 </entry></row> 4421 <row> 4422 <entry><emphasis>Hash</emphasis></entry> 4423 <entry>A unary function object type that acts a hash function for a <code>Key</code>. It takes a single argument of type <code>Key</code> and returns a value of type std::size_t.</entry></row> 4424 <row> 4425 <entry><emphasis>Pred</emphasis></entry> 4426 <entry>A binary function object that implements an equivalence relation on values of type <code>Key</code>. 4427 A binary function object that induces an equivalence relation on values of type <code>Key</code>. 4428 It takes two arguments of type <code>Key</code> and returns a value of type bool.</entry></row> 4429 <row> 4430 <entry><emphasis>Alloc</emphasis></entry> 4431 <entry>An allocator whose value type is the same as the container's value type.</entry></row></tbody></tgroup></informaltable></para> 4432 <para>The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other.</para> 4433 <para>The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.</para> 4434 </description> 4435 <typedef name="key_type"> 4436 <type>Key</type> 4437 </typedef> 4438 <typedef name="value_type"> 4439 <type>std::pair<Key const, Mapped></type> 4440 </typedef> 4441 <typedef name="mapped_type"> 4442 <type>Mapped</type> 4443 </typedef> 4444 <typedef name="hasher"> 4445 <type>Hash</type> 4446 </typedef> 4447 <typedef name="key_equal"> 4448 <type>Pred</type> 4449 </typedef> 4450 <typedef name="allocator_type"> 4451 <type>Alloc</type> 4452 </typedef> 4453 <typedef name="pointer"> 4454 <type>typename allocator_type::pointer</type> 4455 <description> 4456 <para> 4457 <code>value_type*</code> if 4458 <code>allocator_type::pointer</code> is not defined. 4459 </para> 4460 </description> 4461 </typedef> 4462 <typedef name="const_pointer"> 4463 <type>typename allocator_type::const_pointer</type> 4464 <description> 4465 <para> 4466 <code>boost::pointer_to_other<pointer, value_type>::type</code> 4467 if <code>allocator_type::const_pointer</code> is not defined. 4468 </para> 4469 </description> 4470 </typedef> 4471 <typedef name="reference"> 4472 <type>value_type&</type> 4473 <purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose> 4474 </typedef> 4475 <typedef name="const_reference"> 4476 <type>value_type const&</type> 4477 <purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose> 4478 </typedef> 4479 <typedef name="size_type"> 4480 <type><emphasis>implementation-defined</emphasis></type> 4481 <description> 4482 <para>An unsigned integral type.</para> 4483 <para><type>size_type</type> can represent any non-negative value of <type>difference_type</type>.</para> 4484 </description> 4485 </typedef> 4486 <typedef name="difference_type"> 4487 <type><emphasis>implementation-defined</emphasis></type> 4488 <description> 4489 <para>A signed integral type.</para> 4490 <para>Is identical to the difference type of <type>iterator</type> and <type>const_iterator</type>.</para> 4491 </description> 4492 </typedef> 4493 <typedef name="iterator"> 4494 <type><emphasis>implementation-defined</emphasis></type> 4495 <description> 4496 <para>An iterator whose value type is <type>value_type</type>. </para> 4497 <para>The iterator category is at least a forward iterator.</para> 4498 <para>Convertible to <type>const_iterator</type>.</para> 4499 </description> 4500 </typedef> 4501 <typedef name="const_iterator"> 4502 <type><emphasis>implementation-defined</emphasis></type> 4503 <description> 4504 <para>A constant iterator whose value type is <type>value_type</type>. </para> 4505 <para>The iterator category is at least a forward iterator.</para> 4506 </description> 4507 </typedef> 4508 <typedef name="local_iterator"> 4509 <type><emphasis>implementation-defined</emphasis></type> 4510 <description> 4511 <para>An iterator with the same value type, difference type and pointer and reference type as <type>iterator</type>.</para> 4512 <para>A local_iterator object can be used to iterate through a single bucket.</para> 4513 </description> 4514 </typedef> 4515 <typedef name="const_local_iterator"> 4516 <type><emphasis>implementation-defined</emphasis></type> 4517 <description> 4518 <para>A constant iterator with the same value type, difference type and pointer and reference type as <type>const_iterator</type>.</para> 4519 <para>A const_local_iterator object can be used to iterate through a single bucket.</para> 4520 </description> 4521 </typedef> 4522 <typedef name="node_type"> 4523 <type><emphasis>implementation-defined</emphasis></type> 4524 <description> 4525 <para>See <classname>node_handle_map</classname> for details.</para> 4526 </description> 4527 </typedef> 4528 <constructor> 4529 <postconditions> 4530 <code><methodname>size</methodname>() == 0</code> 4531 </postconditions> 4532 <description> 4533 <para>Constructs an empty container using hasher() as the hash function, key_equal() as the key equality predicate, allocator_type() as the allocator and a maximum load factor of 1.0.</para> 4534 </description> 4535 <requires> 4536 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 4537 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 4538 </para> 4539 </requires> 4540 </constructor> 4541 <constructor specifiers="explicit"> 4542 <parameter name="n"> 4543 <paramtype>size_type</paramtype> 4544 </parameter> 4545 <parameter name="hf"> 4546 <paramtype>hasher const&</paramtype> 4547 <default>hasher()</default> 4548 </parameter> 4549 <parameter name="eq"> 4550 <paramtype>key_equal const&</paramtype> 4551 <default>key_equal()</default> 4552 </parameter> 4553 <parameter name="a"> 4554 <paramtype>allocator_type const&</paramtype> 4555 <default>allocator_type()</default> 4556 </parameter> 4557 <postconditions> 4558 <code><methodname>size</methodname>() == 0</code> 4559 </postconditions> 4560 <description> 4561 <para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para> 4562 </description> 4563 <requires> 4564 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 4565 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 4566 </para> 4567 </requires> 4568 </constructor> 4569 <constructor> 4570 <template> 4571 <template-type-parameter name="InputIterator"> 4572 </template-type-parameter> 4573 </template> 4574 <parameter name="f"> 4575 <paramtype>InputIterator</paramtype> 4576 </parameter> 4577 <parameter name="l"> 4578 <paramtype>InputIterator</paramtype> 4579 </parameter> 4580 <parameter name="n"> 4581 <paramtype>size_type</paramtype> 4582 <default><emphasis>implementation-defined</emphasis></default> 4583 </parameter> 4584 <parameter name="hf"> 4585 <paramtype>hasher const&</paramtype> 4586 <default>hasher()</default> 4587 </parameter> 4588 <parameter name="eq"> 4589 <paramtype>key_equal const&</paramtype> 4590 <default>key_equal()</default> 4591 </parameter> 4592 <parameter name="a"> 4593 <paramtype>allocator_type const&</paramtype> 4594 <default>allocator_type()</default> 4595 </parameter> 4596 <description> 4597 <para>Constructs an empty container with at least <code>n</code> buckets, 4598 using <code>hf</code> as the hash function, 4599 <code>eq</code> as the key equality predicate, 4600 <code>a</code> as the allocator and a maximum load factor of 1.0 4601 and inserts the elements from [f, l) into it. 4602 </para> 4603 </description> 4604 <requires> 4605 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 4606 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 4607 </para> 4608 </requires> 4609 </constructor> 4610 <constructor> 4611 <parameter> 4612 <paramtype>unordered_multimap const&</paramtype> 4613 </parameter> 4614 <description> 4615 <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para> 4616 <para>If <code>Allocator::select_on_container_copy_construction</code> 4617 exists and has the right signature, the allocator will be 4618 constructed from its result.</para> 4619 </description> 4620 <requires> 4621 <para><code>value_type</code> is copy constructible</para> 4622 </requires> 4623 </constructor> 4624 <constructor> 4625 <parameter> 4626 <paramtype>unordered_multimap &&</paramtype> 4627 </parameter> 4628 <description> 4629 <para>The move constructor.</para> 4630 </description> 4631 <notes> 4632 <para>This is implemented using Boost.Move.</para> 4633 </notes> 4634 <requires> 4635 <para> 4636 <code>value_type</code> is move constructible. 4637 </para> 4638 <para> 4639 On compilers without rvalue reference support the 4640 emulation does not support moving without calling 4641 <code>boost::move</code> if <code>value_type</code> is 4642 not copyable. So, for example, you can't return the 4643 container from a function. 4644 </para> 4645 </requires> 4646 </constructor> 4647 <constructor specifiers="explicit"> 4648 <parameter name="a"> 4649 <paramtype>Allocator const&</paramtype> 4650 </parameter> 4651 <description> 4652 <para>Constructs an empty container, using allocator <code>a</code>.</para> 4653 </description> 4654 </constructor> 4655 <constructor> 4656 <parameter name="x"> 4657 <paramtype>unordered_multimap const&</paramtype> 4658 </parameter> 4659 <parameter name="a"> 4660 <paramtype>Allocator const&</paramtype> 4661 </parameter> 4662 <description> 4663 <para>Constructs an container, copying <code>x</code>'s contained elements, hash function, predicate, maximum load factor, but using allocator <code>a</code>.</para> 4664 </description> 4665 </constructor> 4666 <constructor> 4667 <parameter name="x"> 4668 <paramtype>unordered_multimap &&</paramtype> 4669 </parameter> 4670 <parameter name="a"> 4671 <paramtype>Allocator const&</paramtype> 4672 </parameter> 4673 <description> 4674 <para>Construct a container moving <code>x</code>'s contained elements, and having the hash function, predicate and maximum load factor, but using allocate <code>a</code>.</para> 4675 </description> 4676 <notes> 4677 <para>This is implemented using Boost.Move.</para> 4678 </notes> 4679 <requires> 4680 <para> 4681 <code>value_type</code> is move insertable. 4682 </para> 4683 </requires> 4684 </constructor> 4685 <constructor> 4686 <parameter name="il"> 4687 <paramtype>initializer_list<value_type></paramtype> 4688 </parameter> 4689 <parameter name="n"> 4690 <paramtype>size_type</paramtype> 4691 <default><emphasis>implementation-defined</emphasis></default> 4692 </parameter> 4693 <parameter name="hf"> 4694 <paramtype>hasher const&</paramtype> 4695 <default>hasher()</default> 4696 </parameter> 4697 <parameter name="eq"> 4698 <paramtype>key_equal const&</paramtype> 4699 <default>key_equal()</default> 4700 </parameter> 4701 <parameter name="a"> 4702 <paramtype>allocator_type const&</paramtype> 4703 <default>allocator_type()</default> 4704 </parameter> 4705 <description> 4706 <para>Constructs an empty container with at least <code>n</code> buckets, 4707 using <code>hf</code> as the hash function, 4708 <code>eq</code> as the key equality predicate, 4709 <code>a</code> as the allocator and a maximum load factor of 1.0 4710 and inserts the elements from <code>il</code> into it. 4711 </para> 4712 </description> 4713 <requires> 4714 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and 4715 <code>allocator_type</code> need to be <code>DefaultConstructible</code>. 4716 </para> 4717 </requires> 4718 </constructor> 4719 <constructor> 4720 <parameter name="n"> 4721 <paramtype>size_type</paramtype> 4722 </parameter> 4723 <parameter name="a"> 4724 <paramtype>allocator_type const&</paramtype> 4725 </parameter> 4726 <postconditions> 4727 <code><methodname>size</methodname>() == 0</code> 4728 </postconditions> 4729 <description> 4730 <para>Constructs an empty container with at least <code>n</code> buckets, 4731 using <code>hf</code> as the hash function, 4732 the default hash function and key equality predicate, 4733 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 4734 </description> 4735 <requires> 4736 <para><code>hasher</code> and <code>key_equal</code> need to be <code>DefaultConstructible</code>. 4737 </para> 4738 </requires> 4739 </constructor> 4740 <constructor> 4741 <parameter name="n"> 4742 <paramtype>size_type</paramtype> 4743 </parameter> 4744 <parameter name="hf"> 4745 <paramtype>hasher const&</paramtype> 4746 </parameter> 4747 <parameter name="a"> 4748 <paramtype>allocator_type const&</paramtype> 4749 </parameter> 4750 <postconditions> 4751 <code><methodname>size</methodname>() == 0</code> 4752 </postconditions> 4753 <description> 4754 <para>Constructs an empty container with at least <code>n</code> buckets, 4755 using <code>hf</code> as the hash function, 4756 the default key equality predicate, 4757 <code>a</code> as the allocator and a maximum load factor of 1.0.</para> 4758 </description> 4759 <requires> 4760 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 4761 </para> 4762 </requires> 4763 </constructor> 4764 <constructor> 4765 <template> 4766 <template-type-parameter name="InputIterator"> 4767 </template-type-parameter> 4768 </template> 4769 <parameter name="f"> 4770 <paramtype>InputIterator</paramtype> 4771 </parameter> 4772 <parameter name="l"> 4773 <paramtype>InputIterator</paramtype> 4774 </parameter> 4775 <parameter name="n"> 4776 <paramtype>size_type</paramtype> 4777 </parameter> 4778 <parameter name="a"> 4779 <paramtype>allocator_type const&</paramtype> 4780 </parameter> 4781 <description> 4782 <para>Constructs an empty container with at least <code>n</code> buckets, 4783 using <code>a</code> as the allocator, with the 4784 default hash function and key equality predicate 4785 and a maximum load factor of 1.0 4786 and inserts the elements from [f, l) into it. 4787 </para> 4788 </description> 4789 <requires> 4790 <para><code>hasher</code>, <code>key_equal</code> need to be <code>DefaultConstructible</code>. 4791 </para> 4792 </requires> 4793 </constructor> 4794 <constructor> 4795 <template> 4796 <template-type-parameter name="InputIterator"> 4797 </template-type-parameter> 4798 </template> 4799 <parameter name="f"> 4800 <paramtype>InputIterator</paramtype> 4801 </parameter> 4802 <parameter name="l"> 4803 <paramtype>InputIterator</paramtype> 4804 </parameter> 4805 <parameter name="n"> 4806 <paramtype>size_type</paramtype> 4807 </parameter> 4808 <parameter name="hf"> 4809 <paramtype>hasher const&</paramtype> 4810 </parameter> 4811 <parameter name="a"> 4812 <paramtype>allocator_type const&</paramtype> 4813 </parameter> 4814 <description> 4815 <para>Constructs an empty container with at least <code>n</code> buckets, 4816 using <code>hf</code> as the hash function, 4817 <code>a</code> as the allocator, with the 4818 default key equality predicate 4819 and a maximum load factor of 1.0 4820 and inserts the elements from [f, l) into it. 4821 </para> 4822 </description> 4823 <requires> 4824 <para><code>key_equal</code> needs to be <code>DefaultConstructible</code>. 4825 </para> 4826 </requires> 4827 </constructor> 4828 <destructor> 4829 <notes> 4830 <para>The destructor is applied to every element, and all memory is deallocated</para> 4831 </notes> 4832 </destructor> 4833 <method name="operator="> 4834 <parameter> 4835 <paramtype>unordered_multimap const&</paramtype> 4836 </parameter> 4837 <type>unordered_multimap&</type> 4838 <description> 4839 <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para> 4840 <para>If <code>Alloc::propagate_on_container_copy_assignment</code> 4841 exists and <code>Alloc::propagate_on_container_copy_assignment::value 4842 </code> is true, the allocator is overwritten, if not the 4843 copied elements are created using the existing 4844 allocator.</para> 4845 </description> 4846 <requires> 4847 <para><code>value_type</code> is copy constructible</para> 4848 </requires> 4849 </method> 4850 <method name="operator="> 4851 <parameter> 4852 <paramtype>unordered_multimap &&</paramtype> 4853 </parameter> 4854 <type>unordered_multimap&</type> 4855 <description> 4856 <para>The move assignment operator.</para> 4857 <para>If <code>Alloc::propagate_on_container_move_assignment</code> 4858 exists and <code>Alloc::propagate_on_container_move_assignment::value 4859 </code> is true, the allocator is overwritten, if not the 4860 moved elements are created using the existing 4861 allocator.</para> 4862 </description> 4863 <notes> 4864 <para> 4865 On compilers without rvalue references, this is emulated using 4866 Boost.Move. Note that on some compilers the copy assignment 4867 operator may be used in some circumstances. 4868 </para> 4869 </notes> 4870 <requires> 4871 <para> 4872 <code>value_type</code> is move constructible. 4873 </para> 4874 </requires> 4875 </method> 4876 <method name="operator="> 4877 <parameter> 4878 <paramtype>initializer_list<value_type></paramtype> 4879 </parameter> 4880 <type>unordered_multimap&</type> 4881 <description> 4882 <para>Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed.</para> 4883 </description> 4884 <requires> 4885 <para> 4886 <code>value_type</code> is <code>CopyInsertable</code> into the container and 4887 <code>CopyAssignable</code>. 4888 </para> 4889 </requires> 4890 </method> 4891 <method name="get_allocator" cv="const"> 4892 <type>allocator_type</type> 4893 </method> 4894 <method-group name="size and capacity"> 4895 <method name="empty" cv="const"> 4896 <type>bool</type> 4897 <returns> 4898 <code><methodname>size</methodname>() == 0</code> 4899 </returns> 4900 </method> 4901 <method name="size" cv="const"> 4902 <type>size_type</type> 4903 <returns> 4904 <code>std::distance(<methodname>begin</methodname>(), <methodname>end</methodname>())</code> 4905 </returns> 4906 </method> 4907 <method name="max_size" cv="const"> 4908 <type>size_type</type> 4909 <returns><code><methodname>size</methodname>()</code> of the largest possible container. 4910 </returns> 4911 </method> 4912 </method-group> 4913 <method-group name="iterators"> 4914 <overloaded-method name="begin"> 4915 <signature><type>iterator</type></signature> 4916 <signature cv="const"><type>const_iterator</type></signature> 4917 <returns>An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 4918 </returns> 4919 </overloaded-method> 4920 <overloaded-method name="end"> 4921 <signature> 4922 <type>iterator</type> 4923 </signature> 4924 <signature cv="const"> 4925 <type>const_iterator</type> 4926 </signature> 4927 <returns>An iterator which refers to the past-the-end value for the container. 4928 </returns> 4929 </overloaded-method> 4930 <method name="cbegin" cv="const"> 4931 <type>const_iterator</type> 4932 <returns>A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. 4933 </returns> 4934 </method> 4935 <method name="cend" cv="const"> 4936 <type>const_iterator</type> 4937 <returns>A constant iterator which refers to the past-the-end value for the container. 4938 </returns> 4939 </method> 4940 </method-group> 4941 <method-group name="modifiers"> 4942 <method name="emplace"> 4943 <template> 4944 <template-type-parameter name="Args" pack="1"> 4945 </template-type-parameter> 4946 </template> 4947 <parameter name="args" pack="1"> 4948 <paramtype>Args&&</paramtype> 4949 </parameter> 4950 <type>iterator</type> 4951 <description> 4952 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container.</para> 4953 </description> 4954 <requires> 4955 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 4956 <code>X</code> from <code>args</code>. 4957 </para> 4958 </requires> 4959 <returns> 4960 <para>An iterator pointing to the inserted element.</para> 4961 </returns> 4962 <throws> 4963 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 4964 </throws> 4965 <notes> 4966 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 4967 <para>Pointers and references to elements are never invalidated.</para> 4968 <para>If the compiler doesn't support variadic template arguments or rvalue 4969 references, this is emulated for up to 10 arguments, with no support 4970 for rvalue references or move semantics.</para> 4971 <para>Since existing <code>std::pair</code> implementations don't support 4972 <code>std::piecewise_construct</code> this emulates it, 4973 but using <code>boost::unordered::piecewise_construct</code>.</para> 4974 </notes> 4975 </method> 4976 <method name="emplace_hint"> 4977 <template> 4978 <template-type-parameter name="Args" pack="1"> 4979 </template-type-parameter> 4980 </template> 4981 <parameter name="hint"> 4982 <paramtype>const_iterator</paramtype> 4983 </parameter> 4984 <parameter name="args" pack="1"> 4985 <paramtype>Args&&</paramtype> 4986 </parameter> 4987 <type>iterator</type> 4988 <description> 4989 <para>Inserts an object, constructed with the arguments <code>args</code>, in the container.</para> 4990 <para><code>hint</code> is a suggestion to where the element should be inserted.</para> 4991 </description> 4992 <requires> 4993 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 4994 <code>X</code> from <code>args</code>. 4995 </para> 4996 </requires> 4997 <returns> 4998 <para>An iterator pointing to the inserted element.</para> 4999 </returns> 5000 <throws> 5001 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5002 </throws> 5003 <notes> 5004 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 5005 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5006 <para>Pointers and references to elements are never invalidated.</para> 5007 <para>If the compiler doesn't support variadic template arguments or rvalue 5008 references, this is emulated for up to 10 arguments, with no support 5009 for rvalue references or move semantics.</para> 5010 <para>Since existing <code>std::pair</code> implementations don't support 5011 <code>std::piecewise_construct</code> this emulates it, 5012 but using <code>boost::unordered::piecewise_construct</code>.</para> 5013 </notes> 5014 </method> 5015 <method name="insert"> 5016 <parameter name="obj"> 5017 <paramtype>value_type const&</paramtype> 5018 </parameter> 5019 <type>iterator</type> 5020 <description> 5021 <para>Inserts <code>obj</code> in the container.</para> 5022 </description> 5023 <requires> 5024 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 5025 </requires> 5026 <returns> 5027 <para>An iterator pointing to the inserted element.</para> 5028 </returns> 5029 <throws> 5030 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5031 </throws> 5032 <notes> 5033 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5034 <para>Pointers and references to elements are never invalidated.</para> 5035 </notes> 5036 </method> 5037 <method name="insert"> 5038 <parameter name="obj"> 5039 <paramtype>value_type&&</paramtype> 5040 </parameter> 5041 <type>iterator</type> 5042 <description> 5043 <para>Inserts <code>obj</code> in the container.</para> 5044 </description> 5045 <requires> 5046 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 5047 </requires> 5048 <returns> 5049 <para>An iterator pointing to the inserted element.</para> 5050 </returns> 5051 <throws> 5052 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5053 </throws> 5054 <notes> 5055 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5056 <para>Pointers and references to elements are never invalidated.</para> 5057 </notes> 5058 </method> 5059 <method name="insert"> 5060 <parameter name="hint"> 5061 <paramtype>const_iterator</paramtype> 5062 </parameter> 5063 <parameter name="obj"> 5064 <paramtype>value_type const&</paramtype> 5065 </parameter> 5066 <type>iterator</type> 5067 <description> 5068 <para>Inserts <code>obj</code> in the container.</para> 5069 <para>hint is a suggestion to where the element should be inserted.</para> 5070 </description> 5071 <requires> 5072 <para><code>value_type</code> is <code>CopyInsertable</code>.</para> 5073 </requires> 5074 <returns> 5075 <para>An iterator pointing to the inserted element.</para> 5076 </returns> 5077 <throws> 5078 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5079 </throws> 5080 <notes> 5081 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 5082 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5083 <para>Pointers and references to elements are never invalidated.</para> 5084 </notes> 5085 </method> 5086 <method name="insert"> 5087 <parameter name="hint"> 5088 <paramtype>const_iterator</paramtype> 5089 </parameter> 5090 <parameter name="obj"> 5091 <paramtype>value_type&&</paramtype> 5092 </parameter> 5093 <type>iterator</type> 5094 <description> 5095 <para>Inserts <code>obj</code> in the container.</para> 5096 <para>hint is a suggestion to where the element should be inserted.</para> 5097 </description> 5098 <requires> 5099 <para><code>value_type</code> is <code>MoveInsertable</code>.</para> 5100 </requires> 5101 <returns> 5102 <para>An iterator pointing to the inserted element.</para> 5103 </returns> 5104 <throws> 5105 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5106 </throws> 5107 <notes> 5108 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 5109 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5110 <para>Pointers and references to elements are never invalidated.</para> 5111 </notes> 5112 </method> 5113 <method name="insert"> 5114 <template> 5115 <template-type-parameter name="InputIterator"> 5116 </template-type-parameter> 5117 </template> 5118 <parameter name="first"> 5119 <paramtype>InputIterator</paramtype> 5120 </parameter> 5121 <parameter name="last"> 5122 <paramtype>InputIterator</paramtype> 5123 </parameter> 5124 <type>void</type> 5125 <description> 5126 <para>Inserts a range of elements into the container. 5127 </para> 5128 </description> 5129 <requires> 5130 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 5131 <code>X</code> from <code>*first</code>.</para> 5132 </requires> 5133 <throws> 5134 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5135 </throws> 5136 <notes> 5137 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5138 <para>Pointers and references to elements are never invalidated.</para> 5139 </notes> 5140 </method> 5141 <method name="insert"> 5142 <parameter name="il"> 5143 <paramtype>initializer_list<value_type></paramtype> 5144 </parameter> 5145 <type>void</type> 5146 <description> 5147 <para>Inserts a range of elements into the container. 5148 </para> 5149 </description> 5150 <requires> 5151 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 5152 <code>X</code> from <code>*first</code>.</para> 5153 </requires> 5154 <throws> 5155 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5156 </throws> 5157 <notes> 5158 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5159 <para>Pointers and references to elements are never invalidated.</para> 5160 </notes> 5161 </method> 5162 <method name="insert"> 5163 <parameter name="il"> 5164 <paramtype>initializer_list<value_type></paramtype> 5165 </parameter> 5166 <type>void</type> 5167 <description> 5168 <para>Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key.</para> 5169 </description> 5170 <requires> 5171 <para><code>value_type</code> is <code>EmplaceConstructible</code> into 5172 <code>X</code> from <code>*first</code>.</para> 5173 </requires> 5174 <throws> 5175 <para>When inserting a single element, if an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5176 </throws> 5177 <notes> 5178 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5179 <para>Pointers and references to elements are never invalidated.</para> 5180 </notes> 5181 </method> 5182 <method name="extract"> 5183 <parameter name="position"> 5184 <paramtype>const_iterator</paramtype> 5185 </parameter> 5186 <type>node_type</type> 5187 <description> 5188 <para>Removes the element pointed to by <code>position</code>.</para> 5189 </description> 5190 <returns> 5191 <para>A <code>node_type</code> owning the element.</para> 5192 </returns> 5193 <notes> 5194 <para> 5195 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_map</code>, 5196 but that is not supported yet. 5197 </para> 5198 </notes> 5199 </method> 5200 <method name="extract"> 5201 <parameter name="k"> 5202 <paramtype>key_type const&</paramtype> 5203 </parameter> 5204 <type>node_type</type> 5205 <description> 5206 <para>Removes an element with key equivalent to <code>k</code>.</para> 5207 </description> 5208 <returns> 5209 <para>A <code>node_type</code> owning the element if found, otherwise an empty <code>node_type</code>.</para> 5210 </returns> 5211 <throws> 5212 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5213 </throws> 5214 <notes> 5215 <para> 5216 In C++17 a node extracted using this method can be inserted into a compatible <code>unordered_map</code>, 5217 but that is not supported yet. 5218 </para> 5219 </notes> 5220 </method> 5221 <method name="insert"> 5222 <parameter name="nh"> 5223 <paramtype>node_type&&</paramtype> 5224 </parameter> 5225 <type>iterator</type> 5226 <description> 5227 <para>If <code>nh</code> is empty, has no affect.</para> 5228 <para>Otherwise inserts the element owned by <code>nh</code></para> 5229 </description> 5230 <requires> 5231 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 5232 </requires> 5233 <returns> 5234 <para>If <code>nh</code> was empty, returns <code>end()</code>.</para> 5235 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 5236 </returns> 5237 <throws> 5238 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5239 </throws> 5240 <notes> 5241 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5242 <para>Pointers and references to elements are never invalidated.</para> 5243 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_map</code>, 5244 but that is not supported yet.</para> 5245 </notes> 5246 </method> 5247 <method name="insert"> 5248 <parameter name="hint"> 5249 <paramtype>const_iterator</paramtype> 5250 </parameter> 5251 <parameter name="nh"> 5252 <paramtype>node_type&&</paramtype> 5253 </parameter> 5254 <type>iterator</type> 5255 <description> 5256 <para>If <code>nh</code> is empty, has no affect.</para> 5257 <para>Otherwise inserts the element owned by <code>nh</code></para> 5258 <para>hint is a suggestion to where the element should be inserted.</para> 5259 </description> 5260 <requires> 5261 <para><code>nh</code> is empty or <code>nh.get_allocator()</code> is equal to the container's allocator.</para> 5262 </requires> 5263 <returns> 5264 <para>If <code>nh</code> was empty, returns <code>end()</code>.</para> 5265 <para>Otherwise returns an iterator pointing to the newly inserted element.</para> 5266 </returns> 5267 <throws> 5268 <para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para> 5269 </throws> 5270 <notes> 5271 <para>The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. </para> 5272 <para>Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.</para> 5273 <para>Pointers and references to elements are never invalidated.</para> 5274 <para>In C++17 this can be used to insert a node extracted from a compatible <code>unordered_map</code>, 5275 but that is not supported yet.</para> 5276 </notes> 5277 </method> 5278 <method name="erase"> 5279 <parameter name="position"> 5280 <paramtype>const_iterator</paramtype> 5281 </parameter> 5282 <type>iterator</type> 5283 <description> 5284 <para>Erase the element pointed to by <code>position</code>.</para> 5285 </description> 5286 <returns> 5287 <para>The iterator following <code>position</code> before the erasure.</para> 5288 </returns> 5289 <throws> 5290 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5291 </throws> 5292 <notes> 5293 <para> 5294 In older versions this could be inefficient because it had to search 5295 through several buckets to find the position of the returned iterator. 5296 The data structure has been changed so that this is no longer the case, 5297 and the alternative erase methods have been deprecated. 5298 </para> 5299 </notes> 5300 </method> 5301 <method name="erase"> 5302 <parameter name="k"> 5303 <paramtype>key_type const&</paramtype> 5304 </parameter> 5305 <type>size_type</type> 5306 <description> 5307 <para>Erase all elements with key equivalent to <code>k</code>.</para> 5308 </description> 5309 <returns> 5310 <para>The number of elements erased.</para> 5311 </returns> 5312 <throws> 5313 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5314 </throws> 5315 </method> 5316 <method name="erase"> 5317 <parameter name="first"> 5318 <paramtype>const_iterator</paramtype> 5319 </parameter> 5320 <parameter name="last"> 5321 <paramtype>const_iterator</paramtype> 5322 </parameter> 5323 <type>iterator</type> 5324 <description> 5325 <para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para> 5326 </description> 5327 <returns> 5328 <para>The iterator following the erased elements - i.e. <code>last</code>.</para> 5329 </returns> 5330 <throws> 5331 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5332 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 5333 </throws> 5334 </method> 5335 <method name="quick_erase"> 5336 <parameter name="position"> 5337 <paramtype>const_iterator</paramtype> 5338 </parameter> 5339 <type>void</type> 5340 <description> 5341 <para>Erase the element pointed to by <code>position</code>.</para> 5342 </description> 5343 <throws> 5344 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5345 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 5346 </throws> 5347 <notes> 5348 <para> 5349 This method was implemented because returning an iterator to 5350 the next element from <code>erase</code> was expensive, but 5351 the container has been redesigned so that is no longer the 5352 case. So this method is now deprecated. 5353 </para> 5354 </notes> 5355 </method> 5356 <method name="erase_return_void"> 5357 <parameter name="position"> 5358 <paramtype>const_iterator</paramtype> 5359 </parameter> 5360 <type>void</type> 5361 <description> 5362 <para>Erase the element pointed to by <code>position</code>.</para> 5363 </description> 5364 <throws> 5365 <para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para> 5366 <para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para> 5367 </throws> 5368 <notes> 5369 <para> 5370 This method was implemented because returning an iterator to 5371 the next element from <code>erase</code> was expensive, but 5372 the container has been redesigned so that is no longer the 5373 case. So this method is now deprecated. 5374 </para> 5375 </notes> 5376 </method> 5377 <method name="clear"> 5378 <type>void</type> 5379 <description> 5380 <para>Erases all elements in the container.</para> 5381 </description> 5382 <postconditions> 5383 <para><code><methodname>size</methodname>() == 0</code></para> 5384 </postconditions> 5385 <throws> 5386 <para>Never throws an exception.</para> 5387 </throws> 5388 </method> 5389 <method name="swap"> 5390 <parameter> 5391 <paramtype>unordered_multimap&</paramtype> 5392 </parameter> 5393 <type>void</type> 5394 <description> 5395 <para>Swaps the contents of the container with the parameter.</para> 5396 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 5397 <code>Allocator::propagate_on_container_swap::value</code> is true then the 5398 containers' allocators are swapped. Otherwise, swapping with unequal allocators 5399 results in undefined behavior.</para> 5400 </description> 5401 <throws> 5402 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 5403 </throws> 5404 <notes> 5405 <para>The exception specifications aren't quite the same as the C++11 standard, as 5406 the equality predieate and hash function are swapped using their copy constructors.</para> 5407 </notes> 5408 </method> 5409 <method name="merge"> 5410 <template> 5411 <template-type-parameter name="H2"> 5412 </template-type-parameter> 5413 <template-type-parameter name="P2"> 5414 </template-type-parameter> 5415 </template> 5416 <parameter name="source"> 5417 <paramtype>unordered_multimap<Key, Mapped, H2, P2, Alloc>&</paramtype> 5418 </parameter> 5419 <notes> 5420 <para>Does not support merging with a compatible <code>unordered_map</code> yet.</para> 5421 </notes> 5422 </method> 5423 <method name="merge"> 5424 <template> 5425 <template-type-parameter name="H2"> 5426 </template-type-parameter> 5427 <template-type-parameter name="P2"> 5428 </template-type-parameter> 5429 </template> 5430 <parameter name="source"> 5431 <paramtype>unordered_multimap<Key, Mapped, H2, P2, Alloc>&&</paramtype> 5432 </parameter> 5433 <notes> 5434 <para>Does not support merging with a compatible <code>unordered_map</code> yet.</para> 5435 </notes> 5436 </method> 5437 </method-group> 5438 <method-group name="observers"> 5439 <method name="hash_function" cv="const"> 5440 <type>hasher</type> 5441 <returns>The container's hash function. 5442 </returns> 5443 </method> 5444 <method name="key_eq" cv="const"> 5445 <type>key_equal</type> 5446 <returns>The container's key equality predicate. 5447 </returns> 5448 </method> 5449 </method-group> 5450 <method-group name="lookup"> 5451 <overloaded-method name="find"> 5452 <signature> 5453 <parameter name="k"> 5454 <paramtype>key_type const&</paramtype> 5455 </parameter> 5456 <type>iterator</type> 5457 </signature> 5458 <signature cv="const"> 5459 <parameter name="k"> 5460 <paramtype>key_type const&</paramtype> 5461 </parameter> 5462 <type>const_iterator</type> 5463 </signature> 5464 <signature> 5465 <template> 5466 <template-type-parameter name="CompatibleKey"/> 5467 <template-type-parameter name="CompatibleHash"/> 5468 <template-type-parameter name="CompatiblePredicate"/> 5469 </template> 5470 <parameter name="k"> 5471 <paramtype>CompatibleKey const&</paramtype> 5472 </parameter> 5473 <parameter name="hash"> 5474 <paramtype>CompatibleHash const&</paramtype> 5475 </parameter> 5476 <parameter name="eq"> 5477 <paramtype>CompatiblePredicate const&</paramtype> 5478 </parameter> 5479 <type>iterator</type> 5480 </signature> 5481 <signature cv="const"> 5482 <template> 5483 <template-type-parameter name="CompatibleKey"/> 5484 <template-type-parameter name="CompatibleHash"/> 5485 <template-type-parameter name="CompatiblePredicate"/> 5486 </template> 5487 <parameter name="k"> 5488 <paramtype>CompatibleKey const&</paramtype> 5489 </parameter> 5490 <parameter name="hash"> 5491 <paramtype>CompatibleHash const&</paramtype> 5492 </parameter> 5493 <parameter name="eq"> 5494 <paramtype>CompatiblePredicate const&</paramtype> 5495 </parameter> 5496 <type>const_iterator</type> 5497 </signature> 5498 <returns> 5499 <para>An iterator pointing to an element with key equivalent to <code>k</code>, or <code>b.end()</code> if no such element exists.</para> 5500 </returns> 5501 <notes><para> 5502 The templated overloads are a non-standard extensions which 5503 allows you to use a compatible hash function and equality 5504 predicate for a key of a different type in order to avoid 5505 an expensive type cast. In general, its use is not encouraged. 5506 </para></notes> 5507 </overloaded-method> 5508 <method name="count" cv="const"> 5509 <parameter name="k"> 5510 <paramtype>key_type const&</paramtype> 5511 </parameter> 5512 <type>size_type</type> 5513 <returns> 5514 <para>The number of elements with key equivalent to <code>k</code>.</para> 5515 </returns> 5516 </method> 5517 <overloaded-method name="equal_range"> 5518 <signature> 5519 <parameter name="k"> 5520 <paramtype>key_type const&</paramtype> 5521 </parameter> 5522 <type>std::pair<iterator, iterator></type> 5523 </signature> 5524 <signature cv="const"> 5525 <parameter name="k"> 5526 <paramtype>key_type const&</paramtype> 5527 </parameter> 5528 <type>std::pair<const_iterator, const_iterator></type> 5529 </signature> 5530 <returns> 5531 <para>A range containing all elements with key equivalent to <code>k</code>. 5532 If the container doesn't container any such elements, returns 5533 <code><functionname>std::make_pair</functionname>(<methodname>b.end</methodname>(),<methodname>b.end</methodname>())</code>. 5534 </para> 5535 </returns> 5536 </overloaded-method> 5537 </method-group> 5538 <method-group name="bucket interface"> 5539 <method name="bucket_count" cv="const"> 5540 <type>size_type</type> 5541 <returns> 5542 <para>The number of buckets.</para> 5543 </returns> 5544 </method> 5545 <method name="max_bucket_count" cv="const"> 5546 <type>size_type</type> 5547 <returns> 5548 <para>An upper bound on the number of buckets.</para> 5549 </returns> 5550 </method> 5551 <method name="bucket_size" cv="const"> 5552 <parameter name="n"> 5553 <paramtype>size_type</paramtype> 5554 </parameter> 5555 <type>size_type</type> 5556 <requires> 5557 <para><code>n < <methodname>bucket_count</methodname>()</code></para> 5558 </requires> 5559 <returns> 5560 <para>The number of elements in bucket <code>n</code>.</para> 5561 </returns> 5562 </method> 5563 <method name="bucket" cv="const"> 5564 <parameter name="k"> 5565 <paramtype>key_type const&</paramtype> 5566 </parameter> 5567 <type>size_type</type> 5568 <returns> 5569 <para>The index of the bucket which would contain an element with key <code>k</code>.</para> 5570 </returns> 5571 <postconditions> 5572 <para>The return value is less than <code>bucket_count()</code></para> 5573 </postconditions> 5574 </method> 5575 <overloaded-method name="begin"> 5576 <signature> 5577 <parameter name="n"> 5578 <paramtype>size_type</paramtype> 5579 </parameter> 5580 <type>local_iterator</type> 5581 </signature> 5582 <signature cv="const"> 5583 <parameter name="n"> 5584 <paramtype>size_type</paramtype> 5585 </parameter> 5586 <type>const_local_iterator</type> 5587 </signature> 5588 <requires> 5589 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 5590 </requires> 5591 <returns> 5592 <para>A local iterator pointing the first element in the bucket with index <code>n</code>.</para> 5593 </returns> 5594 </overloaded-method> 5595 <overloaded-method name="end"> 5596 <signature> 5597 <parameter name="n"> 5598 <paramtype>size_type</paramtype> 5599 </parameter> 5600 <type>local_iterator</type> 5601 </signature> 5602 <signature cv="const"> 5603 <parameter name="n"> 5604 <paramtype>size_type</paramtype> 5605 </parameter> 5606 <type>const_local_iterator</type> 5607 </signature> 5608 <requires> 5609 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 5610 </requires> 5611 <returns> 5612 <para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 5613 </returns> 5614 </overloaded-method> 5615 <method name="cbegin" cv="const"> 5616 <parameter name="n"> 5617 <paramtype>size_type</paramtype> 5618 </parameter> 5619 <type>const_local_iterator</type> 5620 <requires> 5621 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 5622 </requires> 5623 <returns> 5624 <para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para> 5625 </returns> 5626 </method> 5627 <method name="cend"> 5628 <parameter name="n"> 5629 <paramtype>size_type</paramtype> 5630 </parameter> 5631 <type>const_local_iterator</type> 5632 <requires> 5633 <para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para> 5634 </requires> 5635 <returns> 5636 <para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para> 5637 </returns> 5638 </method> 5639 </method-group> 5640 <method-group name="hash policy"> 5641 <method name="load_factor" cv="const"> 5642 <type>float</type> 5643 <returns> 5644 <para>The average number of elements per bucket.</para> 5645 </returns> 5646 </method> 5647 <method name="max_load_factor" cv="const"> 5648 <type>float</type> 5649 <returns> 5650 <para>Returns the current maximum load factor.</para> 5651 </returns> 5652 </method> 5653 <method name="max_load_factor"> 5654 <parameter name="z"> 5655 <paramtype>float</paramtype> 5656 </parameter> 5657 <type>void</type> 5658 <effects> 5659 <para>Changes the container's maximum load factor, using <code>z</code> as a hint.</para> 5660 </effects> 5661 </method> 5662 <method name="rehash"> 5663 <parameter name="n"> 5664 <paramtype>size_type</paramtype> 5665 </parameter> 5666 <type>void</type> 5667 <description> 5668 <para>Changes the number of buckets so that there at least <code>n</code> buckets, and so that the load factor is less than the maximum load factor.</para> 5669 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 5670 </description> 5671 <throws> 5672 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 5673 </throws> 5674 </method> 5675 <method name="reserve"> 5676 <parameter name="n"> 5677 <paramtype>size_type</paramtype> 5678 </parameter> 5679 <type>void</type> 5680 <description> 5681 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para> 5682 </description> 5683 <throws> 5684 <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.</para> 5685 </throws> 5686 </method> 5687 </method-group> 5688 <free-function-group name="Equality Comparisons"> 5689 <function name="operator=="> 5690 <template> 5691 <template-type-parameter name="Key"> 5692 </template-type-parameter> 5693 <template-type-parameter name="Mapped"> 5694 </template-type-parameter> 5695 <template-type-parameter name="Hash"> 5696 </template-type-parameter> 5697 <template-type-parameter name="Pred"> 5698 </template-type-parameter> 5699 <template-type-parameter name="Alloc"> 5700 </template-type-parameter> 5701 </template> 5702 <parameter name="x"> 5703 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 5704 </parameter> 5705 <parameter name="y"> 5706 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 5707 </parameter> 5708 <type>bool</type> 5709 <description> 5710 <para>Return <code>true</code> if <code>x.size() == 5711 y.size</code> and for every equivalent key group in 5712 <code>x</code>, there is a group in <code>y</code> 5713 for the same key, which is a permutation (using 5714 <code>operator==</code> to compare the value types). 5715 </para> 5716 </description> 5717 <notes> 5718 <para>The behavior of this function was changed to match 5719 the C++11 standard in Boost 1.48.</para> 5720 <para>Behavior is undefined if the two containers don't have 5721 equivalent equality predicates.</para> 5722 </notes> 5723 </function> 5724 <function name="operator!="> 5725 <template> 5726 <template-type-parameter name="Key"> 5727 </template-type-parameter> 5728 <template-type-parameter name="Mapped"> 5729 </template-type-parameter> 5730 <template-type-parameter name="Hash"> 5731 </template-type-parameter> 5732 <template-type-parameter name="Pred"> 5733 </template-type-parameter> 5734 <template-type-parameter name="Alloc"> 5735 </template-type-parameter> 5736 </template> 5737 <parameter name="x"> 5738 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 5739 </parameter> 5740 <parameter name="y"> 5741 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&</paramtype> 5742 </parameter> 5743 <type>bool</type> 5744 <description> 5745 <para>Return <code>false</code> if <code>x.size() == 5746 y.size</code> and for every equivalent key group in 5747 <code>x</code>, there is a group in <code>y</code> 5748 for the same key, which is a permutation (using 5749 <code>operator==</code> to compare the value types). 5750 </para> 5751 </description> 5752 <notes> 5753 <para>The behavior of this function was changed to match 5754 the C++11 standard in Boost 1.48.</para> 5755 <para>Behavior is undefined if the two containers don't have 5756 equivalent equality predicates.</para> 5757 </notes> 5758 </function> 5759 </free-function-group> 5760 <free-function-group name="swap"> 5761 <function name="swap"> 5762 <template> 5763 <template-type-parameter name="Key"> 5764 </template-type-parameter> 5765 <template-type-parameter name="Mapped"> 5766 </template-type-parameter> 5767 <template-type-parameter name="Hash"> 5768 </template-type-parameter> 5769 <template-type-parameter name="Pred"> 5770 </template-type-parameter> 5771 <template-type-parameter name="Alloc"> 5772 </template-type-parameter> 5773 </template> 5774 <parameter name="x"> 5775 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc>&</paramtype> 5776 </parameter> 5777 <parameter name="y"> 5778 <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc>&</paramtype> 5779 </parameter> 5780 <type>void</type> 5781 <effects> 5782 <para><code>x.swap(y)</code></para> 5783 </effects> 5784 <description> 5785 <para>Swaps the contents of <code>x</code> and <code>y</code>.</para> 5786 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and 5787 <code>Allocator::propagate_on_container_swap::value</code> is true then the 5788 containers' allocators are swapped. Otherwise, swapping with unequal allocators 5789 results in undefined behavior.</para> 5790 </description> 5791 <throws> 5792 <para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para> 5793 </throws> 5794 <notes> 5795 <para>The exception specifications aren't quite the same as the C++11 standard, as 5796 the equality predieate and hash function are swapped using their copy constructors.</para> 5797 </notes> 5798 </function> 5799 </free-function-group> 5800 </class> 5801 <namespace name="unordered"> 5802 <class name="node_handle_map"> 5803 <template pack="true"> 5804 <template-type-parameter name="ImplementationDefined"/> 5805 </template> 5806 <purpose> 5807 <para> 5808 An object that owns a single element extracted from an 5809 <classname>unordered_map</classname> or an 5810 <classname>unordered_multimap</classname>, that 5811 can then be inserted into a compatible container type. 5812 </para> 5813 <para> 5814 The name and template parameters of this type are implementation 5815 defined, and should be obtained using the <code>node_type</code> 5816 member typedef from the appropriate container. 5817 </para> 5818 </purpose> 5819 <typedef name="key_type"> 5820 <type>typename Container::key_type</type> 5821 </typedef> 5822 <typedef name="mapped_type"> 5823 <type>typename Container::mapped_type</type> 5824 </typedef> 5825 <typedef name="allocator_type"> 5826 <type>typename Container::allocator_type></type> 5827 </typedef> 5828 <constructor specifiers="constexpr" cv="noexcept"> 5829 </constructor> 5830 <destructor/> 5831 <constructor cv="noexcept"> 5832 <parameter> 5833 <paramtype>node_handle_map &&</paramtype> 5834 </parameter> 5835 </constructor> 5836 <method name="operator="> 5837 <parameter> 5838 <paramtype>node_handle_map&&</paramtype> 5839 </parameter> 5840 <type>node_handle_map&</type> 5841 </method> 5842 <method name="key" cv="const"> 5843 <type>key_type&</type> 5844 </method> 5845 <method name="mapped" cv="const"> 5846 <type>mapped_type&</type> 5847 </method> 5848 <method name="get_allocator" cv="const"> 5849 <type>allocator_type</type> 5850 </method> 5851 <method name="operator bool" specifiers="explicit" cv="const noexcept"> 5852 </method> 5853 <method name="empty" cv="const noexcept"> 5854 <type>bool</type> 5855 </method> 5856 <method name="swap" cv="noexcept(ator_traits::propagate_on_container_swap::value)"> 5857 <parameter> 5858 <paramtype>node_handle_map&</paramtype> 5859 </parameter> 5860 <type>void</type> 5861 <notes> 5862 <para> 5863 In C++17 is also <code>noexcept</code> if <code>ator_traits::is_always_equal::value</code> is true. 5864 But we don't support that trait yet. 5865 </para> 5866 </notes> 5867 </method> 5868 <free-function-group name="swap" cv="noexcept(noexcept(x.swap(y)))"> 5869 <function name="swap"> 5870 <template pack="true"> 5871 <template-type-parameter name="ImplementationDefined"/> 5872 </template> 5873 <parameter name="x"> 5874 <paramtype>node_handle_map<ImplementationDefined>&</paramtype> 5875 </parameter> 5876 <parameter name="y"> 5877 <paramtype>node_handle_map<ImplementationDefined>&</paramtype> 5878 </parameter> 5879 <type>void</type> 5880 <effects> 5881 <para><code>x.swap(y)</code></para> 5882 </effects> 5883 </function> 5884 </free-function-group> 5885 </class> 5886 </namespace> 5887 </namespace> 5888 </header> 5889 </library-reference> 5890