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