3 function echo_unordered_docs(
8 ($equivalent_keys ?
'multi' : '').
9 ($map ?
'map' : 'set');
13 $template_value = <<<EOL
14 <template-type-parameter name="Key">
15 </template-type-parameter>
16 <template-type-parameter name="Mapped">
17 </template-type-parameter>
23 $value_type = 'std::pair<Key const, Mapped>';
24 $full_type = $name.'<Key, Mapped, Hash, Pred, Alloc>';
28 $template_value = <<<EOL
29 <template-type-parameter name="Value">
30 </template-type-parameter>
36 $value_type = 'Value';
37 $full_type = $name.'<Value, Hash, Pred, Alloc>';
40 <class name
="<?php echo $name ?>">
42 <?php
echo $template_value; ?
>
43 <template
-type
-parameter name
="Hash">
44 <default><type
>boost
::hash
<
;<?php
echo $key_type; ?
>>
;</type
></default>
45 </template
-type
-parameter
>
46 <template
-type
-parameter name
="Pred">
47 <default><type
>std
::equal_to
<
;<?php
echo $key_type; ?
>>
;</type
></default>
48 </template
-type
-parameter
>
49 <template
-type
-parameter name
="Alloc">
50 <default><type
>std
::allocator
<
;<?php
echo $value_type; ?
>>
;</type
></default>
51 </template
-type
-parameter
>
54 An unordered associative container that
<?php
55 echo $map ?
'associates ' : 'stores ';
56 echo $equivalent_keys ?
'' : 'unique ';
57 echo $map ?
'keys with another value.' : 'values.';
58 echo $equivalent_keys ?
' The same key can be stored multiple times.' : '';
63 <para
><emphasis role
="bold">Template Parameters
</emphasis
>
69 <entry
><emphasis
>Key
</emphasis
></entry
>
70 <entry
><code
>Key
</code
> must be
<code
>Erasable
</code
> from the container
71 (i
.e
. <code
>allocator_traits
</code
> can
<code
>destroy
</code
> it
).
74 <entry
><emphasis
>Mapped
</emphasis
></entry
>
75 <entry
><code
>Mapped
</code
> must be
<code
>Erasable
</code
> from the container
76 (i
.e
. <code
>allocator_traits
</code
> can
<code
>destroy
</code
> it
).
80 <entry
><emphasis
>Value
</emphasis
></entry
>
81 <entry
><code
>Value
</code
> must be
<code
>Erasable
</code
> from the container
82 (i
.e
. <code
>allocator_traits
</code
> can
<code
>destroy
</code
> it
).
86 <entry
><emphasis
>Hash
</emphasis
></entry
>
87 <entry
>A unary
function object type that acts a hash
function for a
<code
><?php
echo $key_type; ?
></code
>. It takes a single argument of type
<code
><?php
echo $key_type; ?
></code
> and returns a value of type std
::size_t
.</entry
></row
>
89 <entry
><emphasis
>Pred
</emphasis
></entry
>
90 <entry
>A binary
function object that
implements an equivalence relation on values of type
<code
><?php
echo $key_type; ?
></code
>.
91 A binary
function object that induces an equivalence relation on values of type
<code
><?php
echo $key_type; ?
></code
>.
92 It takes two arguments of type
<code
><?php
echo $key_type; ?
></code
> and returns a value of type
bool.</entry
></row
>
94 <entry
><emphasis
>Alloc
</emphasis
></entry
>
95 <entry
>An allocator whose value type is the same
as the container
's value type.</entry></row></tbody></tgroup></informaltable></para>
96 <para>The elements are organized into buckets. <?php
97 echo $equivalent_keys ?
98 'Keys with the same hash code are stored in the same bucket
and elements with equivalent keys are stored next to each other
.' :
99 'Keys with the same hash code are stored in the same bucket
.';
101 <para>The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.</para>
103 <typedef name="key_type">
104 <type><?php echo $key_type; ?></type>
106 <typedef name="value_type">
107 <type><?php echo $value_type; ?></type>
110 <typedef name="mapped_type">
114 <typedef name="hasher">
117 <typedef name="key_equal">
120 <typedef name="allocator_type">
123 <typedef name="pointer">
124 <type>typename allocator_type::pointer</type>
127 <code>value_type*</code> if
128 <code>allocator_type::pointer</code> is not defined.
132 <typedef name="const_pointer">
133 <type>typename allocator_type::const_pointer</type>
136 <code>boost::pointer_to_other<pointer, value_type>::type</code>
137 if <code>allocator_type::const_pointer</code> is not defined.
141 <typedef name="reference">
142 <type>value_type&</type>
143 <purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose>
145 <typedef name="const_reference">
146 <type>value_type const&</type>
147 <purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose>
149 <typedef name="size_type">
150 <type><emphasis>implementation-defined</emphasis></type>
152 <para>An unsigned integral type.</para>
153 <para><type>size_type</type> can represent any non-negative value of <type>difference_type</type>.</para>
156 <typedef name="difference_type">
157 <type><emphasis>implementation-defined</emphasis></type>
159 <para>A signed integral type.</para>
160 <para>Is identical to the difference type of <type>iterator</type> and <type>const_iterator</type>.</para>
163 <typedef name="iterator">
164 <type><emphasis>implementation-defined</emphasis></type>
166 <para><?php echo $map ? 'An
' : 'A constant
' ?> iterator whose value type is <type>value_type</type>. </para>
167 <para>The iterator category is at least a forward iterator.</para>
168 <para>Convertible to <type>const_iterator</type>.</para>
171 <typedef name="const_iterator">
172 <type><emphasis>implementation-defined</emphasis></type>
174 <para>A constant iterator whose value type is <type>value_type</type>. </para>
175 <para>The iterator category is at least a forward iterator.</para>
178 <typedef name="local_iterator">
179 <type><emphasis>implementation-defined</emphasis></type>
181 <para>An iterator with the same value type, difference type and pointer and reference type as <type>iterator</type>.</para>
182 <para>A local_iterator object can be used to iterate through a single bucket.</para>
185 <typedef name="const_local_iterator">
186 <type><emphasis>implementation-defined</emphasis></type>
188 <para>A constant iterator with the same value type, difference type and pointer and reference type as <type>const_iterator</type>.</para>
189 <para>A const_local_iterator object can be used to iterate through a single bucket.</para>
194 <code><methodname>size</methodname>() == 0</code>
197 <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>
200 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and
201 <code>allocator_type</code> need to be <code>DefaultConstructible</code>.
205 <constructor specifiers="explicit">
207 <paramtype>size_type</paramtype>
209 <parameter name="hf">
210 <paramtype>hasher const&</paramtype>
211 <default>hasher()</default>
213 <parameter name="eq">
214 <paramtype>key_equal const&</paramtype>
215 <default>key_equal()</default>
218 <paramtype>allocator_type const&</paramtype>
219 <default>allocator_type()</default>
222 <code><methodname>size</methodname>() == 0</code>
225 <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>
228 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and
229 <code>allocator_type</code> need to be <code>DefaultConstructible</code>.
235 <template-type-parameter name="InputIterator">
236 </template-type-parameter>
239 <paramtype>InputIterator</paramtype>
242 <paramtype>InputIterator</paramtype>
245 <paramtype>size_type</paramtype>
246 <default><emphasis>implementation-defined</emphasis></default>
248 <parameter name="hf">
249 <paramtype>hasher const&</paramtype>
250 <default>hasher()</default>
252 <parameter name="eq">
253 <paramtype>key_equal const&</paramtype>
254 <default>key_equal()</default>
257 <paramtype>allocator_type const&</paramtype>
258 <default>allocator_type()</default>
261 <para>Constructs an empty container with at least <code>n</code> buckets,
262 using <code>hf</code> as the hash function,
263 <code>eq</code> as the key equality predicate,
264 <code>a</code> as the allocator and a maximum load factor of 1.0
265 and inserts the elements from [f, l) into it.
269 <para>If the defaults are used, <code>hasher</code>, <code>key_equal</code> and
270 <code>allocator_type</code> need to be <code>DefaultConstructible</code>.
276 <paramtype><?php echo $name; ?> const&</paramtype>
279 <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para>
280 <para>If <code>Allocator::select_on_container_copy_construction</code>
281 exists and has the right signature, the allocator will be
282 constructed from its result.</para>
285 <para><code>value_type</code> is copy constructible</para>
290 <paramtype><?php echo $name; ?> &&</paramtype>
293 <para>The move constructor.</para>
296 <para>This is implemented using Boost.Move.</para>
300 <code>value_type</code> is move constructible.
303 On compilers without rvalue reference support the
304 emulation does not support moving without calling
305 <code>boost::move</code> if <code>value_type</code> is
306 not copyable. So, for example, you can't
return the
307 container from a
function.
311 <constructor specifiers
="explicit">
313 <paramtype
>Allocator
const&
;</paramtype
>
316 <para
>Constructs an
empty container
, using allocator
<code
>a
</code
>.</para
>
321 <paramtype
><?php
echo $name; ?
> const&
;</paramtype
>
324 <paramtype
>Allocator
const&
;</paramtype
>
327 <para
>Constructs an container
, copying
<code
>x
</code
>'s contained elements, hash function, predicate, maximum load factor, but using allocator <code>a</code>.</para>
332 <paramtype><?php echo $name; ?> &&</paramtype>
335 <paramtype>Allocator const&</paramtype>
338 <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
>
341 <para
>This is implemented using Boost
.Move
.</para
>
345 <code
>value_type
</code
> is move insertable
.
350 <parameter name
="il">
351 <paramtype
>initializer_list
<
;value_type
>
;</paramtype
>
354 <paramtype
>size_type
</paramtype
>
355 <default><emphasis
>implementation
-defined
</emphasis
></default>
357 <parameter name
="hf">
358 <paramtype
>hasher
const&
;</paramtype
>
359 <default>hasher()</default>
361 <parameter name
="eq">
362 <paramtype
>key_equal
const&
;</paramtype
>
363 <default>key_equal()</default>
366 <paramtype
>allocator_type
const&
;</paramtype
>
367 <default>allocator_type()</default>
370 <para
>Constructs an
empty container with at least
<code
>n
</code
> buckets
,
371 using
<code
>hf
</code
> as the hash
function,
372 <code
>eq
</code
> as the key equality predicate
,
373 <code
>a
</code
> as the allocator
and a maximum load factor of
1.0
374 and inserts the elements from
<code
>il
</code
> into it
.
378 <para
>If the defaults are used
, <code
>hasher
</code
>, <code
>key_equal
</code
> and
379 <code
>allocator_type
</code
> need to be
<code
>DefaultConstructible
</code
>.
385 <paramtype
>size_type
</paramtype
>
388 <paramtype
>allocator_type
const&
;</paramtype
>
391 <code
><methodname
>size
</methodname
>() == 0</code
>
394 <para
>Constructs an
empty container with at least
<code
>n
</code
> buckets
,
395 using
<code
>hf
</code
> as the hash
function,
396 the
default hash
function and key equality predicate
,
397 <code
>a
</code
> as the allocator
and a maximum load factor of
1.0.</para
>
400 <para
><code
>hasher
</code
> and <code
>key_equal
</code
> need to be
<code
>DefaultConstructible
</code
>.
406 <paramtype
>size_type
</paramtype
>
408 <parameter name
="hf">
409 <paramtype
>hasher
const&
;</paramtype
>
412 <paramtype
>allocator_type
const&
;</paramtype
>
415 <code
><methodname
>size
</methodname
>() == 0</code
>
418 <para
>Constructs an
empty container with at least
<code
>n
</code
> buckets
,
419 using
<code
>hf
</code
> as the hash
function,
420 the
default key equality predicate
,
421 <code
>a
</code
> as the allocator
and a maximum load factor of
1.0.</para
>
424 <para
><code
>key_equal
</code
> needs to be
<code
>DefaultConstructible
</code
>.
430 <template
-type
-parameter name
="InputIterator">
431 </template
-type
-parameter
>
434 <paramtype
>InputIterator
</paramtype
>
437 <paramtype
>InputIterator
</paramtype
>
440 <paramtype
>size_type
</paramtype
>
443 <paramtype
>allocator_type
const&
;</paramtype
>
446 <para
>Constructs an
empty container with at least
<code
>n
</code
> buckets
,
447 using
<code
>a
</code
> as the allocator
, with the
448 default hash
function and key equality predicate
449 and a maximum load factor of
1.0
450 and inserts the elements from
[f
, l
) into it
.
454 <para
><code
>hasher
</code
>, <code
>key_equal
</code
> need to be
<code
>DefaultConstructible
</code
>.
460 <template
-type
-parameter name
="InputIterator">
461 </template
-type
-parameter
>
464 <paramtype
>InputIterator
</paramtype
>
467 <paramtype
>InputIterator
</paramtype
>
470 <paramtype
>size_type
</paramtype
>
472 <parameter name
="hf">
473 <paramtype
>hasher
const&
;</paramtype
>
476 <paramtype
>allocator_type
const&
;</paramtype
>
479 <para
>Constructs an
empty container with at least
<code
>n
</code
> buckets
,
480 using
<code
>hf
</code
> as the hash
function,
481 <code
>a
</code
> as the allocator
, with the
482 default key equality predicate
483 and a maximum load factor of
1.0
484 and inserts the elements from
[f
, l
) into it
.
488 <para
><code
>key_equal
</code
> needs to be
<code
>DefaultConstructible
</code
>.
494 <para
>The destructor is applied to every element
, and all memory is deallocated
</para
>
497 <method name
="operator=">
499 <paramtype
><?php
echo $name; ?
> const&
;</paramtype
>
501 <type
><?php
echo $name; ?
>&
;</type
>
503 <para
>The assignment operator
. Copies the contained elements
, hash
function, predicate
and maximum load factor but not the allocator
.</para
>
504 <para
>If <code
>Alloc
::propagate_on_container_copy_assignment
</code
>
505 exists
and <code
>Alloc
::propagate_on_container_copy_assignment
::value
506 </code
> is
true, the allocator is overwritten
, if not the
507 copied elements are created using the existing
511 <para
><code
>value_type
</code
> is copy constructible
</para
>
514 <method name
="operator=">
516 <paramtype
><?php
echo $name; ?
> &
;&
;</paramtype
>
518 <type
><?php
echo $name; ?
>&
;</type
>
520 <para
>The move assignment operator
.</para
>
521 <para
>If <code
>Alloc
::propagate_on_container_move_assignment
</code
>
522 exists
and <code
>Alloc
::propagate_on_container_move_assignment
::value
523 </code
> is
true, the allocator is overwritten
, if not the
524 moved elements are created using the existing
529 On compilers without rvalue references
, this is emulated using
530 Boost
.Move
. Note that on some compilers the copy assignment
531 operator may be used in some circumstances
.
536 <code
>value_type
</code
> is move constructible
.
540 <method name
="operator=">
542 <paramtype
>initializer_list
<
;value_type
>
;</paramtype
>
544 <type
><?php
echo $name; ?
>&
;</type
>
546 <para
>Assign from values in initializer
list. All existing elements are either overwritten by the
new elements
or destroyed
.</para
>
550 <code
>value_type
</code
> is
<code
>CopyInsertable
</code
> into the container
and
551 <code
>CopyAssignable
</code
>.
555 <method name
="get_allocator" cv
="const">
556 <type
>allocator_type
</type
>
558 <method
-group name
="size and capacity">
559 <method name
="empty" cv
="const">
562 <code
><methodname
>size
</methodname
>() == 0</code
>
565 <method name
="size" cv
="const">
566 <type
>size_type
</type
>
568 <code
>std
::distance(<methodname
>begin
</methodname
>(), <methodname
>end
</methodname
>())</code
>
571 <method name
="max_size" cv
="const">
572 <type
>size_type
</type
>
573 <returns
><code
><methodname
>size
</methodname
>()</code
> of the largest possible container
.
577 <method
-group name
="iterators">
578 <overloaded
-method name
="begin">
579 <signature
><type
>iterator
</type
></signature
>
580 <signature cv
="const"><type
>const_iterator
</type
></signature
>
581 <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
.
584 <overloaded
-method name
="end">
586 <type
>iterator
</type
>
588 <signature cv
="const">
589 <type
>const_iterator
</type
>
591 <returns
>An iterator which refers to the past
-the
-end value
for the container
.
594 <method name
="cbegin" cv
="const">
595 <type
>const_iterator
</type
>
596 <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
.
599 <method name
="cend" cv
="const">
600 <type
>const_iterator
</type
>
601 <returns
>A constant iterator which refers to the past
-the
-end value
for the container
.
605 <method
-group name
="modifiers">
606 <method name
="emplace">
608 <template
-type
-parameter name
="Args" pack
="1">
609 </template
-type
-parameter
>
611 <parameter name
="args" pack
="1">
612 <paramtype
>Args
&
;&
;</paramtype
>
614 <type
><?php
echo $equivalent_keys ?
'iterator' : 'std::pair<iterator, bool>' ?
></type
>
616 <para
>Inserts an
object, constructed with the arguments
<code
>args
</code
>, in the container
<?php
617 echo $equivalent_keys ?
'.' :
618 ' if and only if there is no element in the container with an equivalent '.$key_name. '.';
622 <para
><code
>value_type
</code
> is
<code
>EmplaceConstructible
</code
> into
623 <code
>X
</code
> from
<code
>args
</code
>.
627 <?php
if ($equivalent_keys): ?
>
628 <para
>An iterator pointing to the inserted element
.</para
>
630 <para
>The
bool component of the
return type is
true if an insert took place
.</para
>
631 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
635 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
638 <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
>
639 <para
>Pointers
and references to elements are never invalidated
.</para
>
640 <para
>If the compiler doesn
't support variadic template arguments or rvalue
641 references, this is emulated for up to 10 arguments, with no support
642 for rvalue references or move semantics.</para>
643 <para>Since existing <code>std::pair</code> implementations don't support
644 <code
>std
::piecewise_construct
</code
> this emulates it
,
645 but using
<code
>boost
::unordered
::piecewise_construct
</code
>.</para
>
648 <method name
="emplace_hint">
650 <template
-type
-parameter name
="Args" pack
="1">
651 </template
-type
-parameter
>
653 <parameter name
="hint">
654 <paramtype
>const_iterator
</paramtype
>
656 <parameter name
="args" pack
="1">
657 <paramtype
>Args
&
;&
;</paramtype
>
659 <type
>iterator
</type
>
661 <para
>Inserts an
object, constructed with the arguments
<code
>args
</code
>, in the container
<?php
662 echo $equivalent_keys ?
'.' :
663 ' if and only if there is no element in the container with an equivalent '.$key_name. '.';
665 <para
><code
>hint
</code
> is a suggestion to where the element should be inserted
.</para
>
668 <para
><code
>value_type
</code
> is
<code
>EmplaceConstructible
</code
> into
669 <code
>X
</code
> from
<code
>args
</code
>.
673 <?php
if ($equivalent_keys): ?
>
674 <para
>An iterator pointing to the inserted element
.</para
>
676 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
680 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
683 <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
<?php
echo $key_name; ?
>. </para
>
684 <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
>
685 <para
>Pointers
and references to elements are never invalidated
.</para
>
686 <para
>If the compiler doesn
't support variadic template arguments or rvalue
687 references, this is emulated for up to 10 arguments, with no support
688 for rvalue references or move semantics.</para>
689 <para>Since existing <code>std::pair</code> implementations don't support
690 <code
>std
::piecewise_construct
</code
> this emulates it
,
691 but using
<code
>boost
::unordered
::piecewise_construct
</code
>.</para
>
694 <method name
="insert">
695 <parameter name
="obj">
696 <paramtype
>value_type
const&
;</paramtype
>
698 <type
><?php
echo $equivalent_keys ?
'iterator' : 'std::pair<iterator, bool>' ?
></type
>
700 <para
>Inserts
<code
>obj
</code
> in the container
<?php
701 echo $equivalent_keys ?
'.' :
702 ' if and only if there is no element in the container with an equivalent '.$key_name. '.';
706 <para
><code
>value_type
</code
> is
<code
>CopyInsertable
</code
>.</para
>
709 <?php
if ($equivalent_keys): ?
>
710 <para
>An iterator pointing to the inserted element
.</para
>
712 <para
>The
bool component of the
return type is
true if an insert took place
.</para
>
713 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
717 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
720 <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
>
721 <para
>Pointers
and references to elements are never invalidated
.</para
>
724 <method name
="insert">
725 <parameter name
="obj">
726 <paramtype
>value_type
&
;&
;</paramtype
>
728 <type
><?php
echo $equivalent_keys ?
'iterator' : 'std::pair<iterator, bool>' ?
></type
>
730 <para
>Inserts
<code
>obj
</code
> in the container
<?php
731 echo $equivalent_keys ?
'.' :
732 ' if and only if there is no element in the container with an equivalent '.$key_name. '.';
736 <para
><code
>value_type
</code
> is
<code
>MoveInsertable
</code
>.</para
>
739 <?php
if ($equivalent_keys): ?
>
740 <para
>An iterator pointing to the inserted element
.</para
>
742 <para
>The
bool component of the
return type is
true if an insert took place
.</para
>
743 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
747 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
750 <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
>
751 <para
>Pointers
and references to elements are never invalidated
.</para
>
754 <method name
="insert">
755 <parameter name
="hint">
756 <paramtype
>const_iterator
</paramtype
>
758 <parameter name
="obj">
759 <paramtype
>value_type
const&
;</paramtype
>
761 <type
>iterator
</type
>
763 <?php
if ($equivalent_keys): ?
>
764 <para
>Inserts
<code
>obj
</code
> in the container
.</para
>
766 <para
>Inserts
<code
>obj
</code
> in the container
if and only
if there is no element in the container with an equivalent
<?php
echo $key_name; ?
>.</para
>
768 <para
>hint is a suggestion to where the element should be inserted
.</para
>
771 <para
><code
>value_type
</code
> is
<code
>CopyInsertable
</code
>.</para
>
774 <?php
if ($equivalent_keys): ?
>
775 <para
>An iterator pointing to the inserted element
.</para
>
777 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
781 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
784 <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
<?php
echo $key_name; ?
>. </para
>
785 <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
>
786 <para
>Pointers
and references to elements are never invalidated
.</para
>
789 <method name
="insert">
790 <parameter name
="hint">
791 <paramtype
>const_iterator
</paramtype
>
793 <parameter name
="obj">
794 <paramtype
>value_type
&
;&
;</paramtype
>
796 <type
>iterator
</type
>
798 <?php
if ($equivalent_keys): ?
>
799 <para
>Inserts
<code
>obj
</code
> in the container
.</para
>
801 <para
>Inserts
<code
>obj
</code
> in the container
if and only
if there is no element in the container with an equivalent
<?php
echo $key_name; ?
>.</para
>
803 <para
>hint is a suggestion to where the element should be inserted
.</para
>
806 <para
><code
>value_type
</code
> is
<code
>MoveInsertable
</code
>.</para
>
809 <?php
if ($equivalent_keys): ?
>
810 <para
>An iterator pointing to the inserted element
.</para
>
812 <para
>If an insert took place
, then the iterator points to the newly inserted element
. Otherwise
, it points to the element with equivalent
<?php
echo $key_name; ?
>.</para
>
816 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
819 <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
<?php
echo $key_name; ?
>. </para
>
820 <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
>
821 <para
>Pointers
and references to elements are never invalidated
.</para
>
824 <method name
="insert">
826 <template
-type
-parameter name
="InputIterator">
827 </template
-type
-parameter
>
829 <parameter name
="first">
830 <paramtype
>InputIterator
</paramtype
>
832 <parameter name
="last">
833 <paramtype
>InputIterator
</paramtype
>
837 <para
>Inserts a range of elements into the container
.
838 <?php
if (!$equivalent_keys): ?
>
839 Elements are inserted
if and only
if there is no element in the container with an equivalent
<?php
echo $key_name; ?
>.
844 <para
><code
>value_type
</code
> is
<code
>EmplaceConstructible
</code
> into
845 <code
>X
</code
> from
<code
>*first
</code
>.</para
>
848 <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
>
851 <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
>
852 <para
>Pointers
and references to elements are never invalidated
.</para
>
855 <method name
="insert">
856 <parameter name
="il">
857 <paramtype
>initializer_list
<
;value_type
>
;</paramtype
>
861 <para
>Inserts a range of elements into the container
.
862 <?php
if (!$equivalent_keys): ?
>
863 Elements are inserted
if and only
if there is no element in the container with an equivalent
<?php
echo $key_name; ?
>.
868 <para
><code
>value_type
</code
> is
<code
>EmplaceConstructible
</code
> into
869 <code
>X
</code
> from
<code
>*first
</code
>.</para
>
872 <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
>
875 <para
>Can invalidate iterators
, but only
if the insert causes the load factor to be greater to
or equal to the maximum load factor
.</para
>
876 <para
>Pointers
and references to elements are never invalidated
.</para
>
879 <method name
="erase">
880 <parameter name
="position">
881 <paramtype
>const_iterator
</paramtype
>
883 <type
>iterator
</type
>
885 <para
>Erase the element pointed to by
<code
>position
</code
>.</para
>
888 <para
>The iterator following
<code
>position
</code
> before the erasure
.</para
>
891 <para
>Only throws an exception
if it is thrown by
<code
>hasher
</code
> or <code
>key_equal
</code
>.</para
>
895 In older versions this could be inefficient because it had to search
896 through several buckets to find the position of the returned iterator
.
897 The data structure has been changed so that this is no longer the
case,
898 and the alternative erase methods have been deprecated
.
902 <method name
="erase">
904 <paramtype
>key_type
const&
;</paramtype
>
906 <type
>size_type
</type
>
908 <para
>Erase all elements with key equivalent to
<code
>k
</code
>.</para
>
911 <para
>The number of elements erased
.</para
>
914 <para
>Only throws an exception
if it is thrown by
<code
>hasher
</code
> or <code
>key_equal
</code
>.</para
>
917 <method name
="erase">
918 <parameter name
="first">
919 <paramtype
>const_iterator
</paramtype
>
921 <parameter name
="last">
922 <paramtype
>const_iterator
</paramtype
>
924 <type
>iterator
</type
>
926 <para
>Erases the elements in the range from
<code
>first
</code
> to
<code
>last
</code
>.</para
>
929 <para
>The iterator following the erased elements
- i
.e
. <code
>last
</code
>.</para
>
932 <para
>Only throws an exception
if it is thrown by
<code
>hasher
</code
> or <code
>key_equal
</code
>.</para
>
933 <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
>
936 <method name
="quick_erase">
937 <parameter name
="position">
938 <paramtype
>const_iterator
</paramtype
>
942 <para
>Erase the element pointed to by
<code
>position
</code
>.</para
>
945 <para
>Only throws an exception
if it is thrown by
<code
>hasher
</code
> or <code
>key_equal
</code
>.</para
>
946 <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
>
950 This method was implemented because returning an iterator to
951 the next element from
<code
>erase
</code
> was expensive
, but
952 the container has been redesigned so that is no longer the
953 case. So this method is now deprecated
.
957 <method name
="erase_return_void">
958 <parameter name
="position">
959 <paramtype
>const_iterator
</paramtype
>
963 <para
>Erase the element pointed to by
<code
>position
</code
>.</para
>
966 <para
>Only throws an exception
if it is thrown by
<code
>hasher
</code
> or <code
>key_equal
</code
>.</para
>
967 <para
>In this implementation
, this overload doesn
't call either function object's methods so it is no
throw, but this might not be
true in other implementations
.</para
>
971 This method was implemented because returning an iterator to
972 the next element from
<code
>erase
</code
> was expensive
, but
973 the container has been redesigned so that is no longer the
974 case. So this method is now deprecated
.
978 <method name
="clear">
981 <para
>Erases all elements in the container
.</para
>
984 <para
><code
><methodname
>size
</methodname
>() == 0</code
></para
>
987 <para
>Never throws an exception
.</para
>
992 <paramtype
><?php
echo $name; ?
>&
;</paramtype
>
996 <para
>Swaps the contents of the container with the parameter
.</para
>
997 <para
>If <code
>Allocator
::propagate_on_container_swap
</code
> is declared
and
998 <code
>Allocator
::propagate_on_container_swap
::value
</code
> is
true then the
999 containers
' allocators are swapped. Otherwise, swapping with unequal allocators
1000 results in undefined behavior.</para>
1003 <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
>
1006 <para
>The exception specifications aren
't quite the same as the C++11 standard, as
1007 the equality predieate and hash function are swapped using their copy constructors.</para>
1011 <method-group name="observers">
1012 <method name="hash_function" cv="const">
1014 <returns>The container's hash
function.
1017 <method name
="key_eq" cv
="const">
1018 <type
>key_equal
</type
>
1019 <returns
>The container
's key equality predicate.
1023 <method-group name="lookup">
1024 <overloaded-method name="find">
1026 <parameter name="k">
1027 <paramtype>key_type const&</paramtype>
1029 <type>iterator</type>
1031 <signature cv="const">
1032 <parameter name="k">
1033 <paramtype>key_type const&</paramtype>
1035 <type>const_iterator</type>
1039 <template-type-parameter name="CompatibleKey"/>
1040 <template-type-parameter name="CompatibleHash"/>
1041 <template-type-parameter name="CompatiblePredicate"/>
1043 <parameter name="k">
1044 <paramtype>CompatibleKey const&</paramtype>
1046 <parameter name="hash">
1047 <paramtype>CompatibleHash const&</paramtype>
1049 <parameter name="eq">
1050 <paramtype>CompatiblePredicate const&</paramtype>
1052 <type>iterator</type>
1054 <signature cv="const">
1056 <template-type-parameter name="CompatibleKey"/>
1057 <template-type-parameter name="CompatibleHash"/>
1058 <template-type-parameter name="CompatiblePredicate"/>
1060 <parameter name="k">
1061 <paramtype>CompatibleKey const&</paramtype>
1063 <parameter name="hash">
1064 <paramtype>CompatibleHash const&</paramtype>
1066 <parameter name="eq">
1067 <paramtype>CompatiblePredicate const&</paramtype>
1069 <type>const_iterator</type>
1072 <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>
1075 The templated overloads are a non-standard extensions which
1076 allows you to use a compatible hash function and equality
1077 predicate for a key of a different type in order to avoid
1078 an expensive type cast. In general, its use is not encouraged.
1080 </overloaded-method>
1081 <method name="count" cv="const">
1082 <parameter name="k">
1083 <paramtype>key_type const&</paramtype>
1085 <type>size_type</type>
1087 <para>The number of elements with key equivalent to <code>k</code>.</para>
1090 <overloaded-method name="equal_range">
1092 <parameter name="k">
1093 <paramtype>key_type const&</paramtype>
1095 <type>std::pair<iterator, iterator></type>
1097 <signature cv="const">
1098 <parameter name="k">
1099 <paramtype>key_type const&</paramtype>
1101 <type>std::pair<const_iterator, const_iterator></type>
1104 <para>A range containing all elements with key equivalent to <code>k</code>.
1105 If the container doesn't container any such elements
, returns
1106 <code
><functionname
>std
::make_pair
</functionname
>(<methodname
>b
.end
</methodname
>(),<methodname
>b
.end
</methodname
>())</code
>.
1109 </overloaded
-method
>
1110 <?php
if ($map && !$equivalent_keys): ?
>
1111 <method name
="operator[]">
1112 <parameter name
="k">
1113 <paramtype
>key_type
const&
;</paramtype
>
1115 <type
>mapped_type
&
;</type
>
1117 <para
>If the container does not already contain an elements with a key equivalent to
<code
>k
</code
>, inserts the value
<code
>std
::pair
<
;key_type
const, mapped_type
>
;(k
, mapped_type())</code
></para
>
1120 <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
>
1123 <para
>If an exception is thrown by an operation other than a call to
<code
>hasher
</code
> the
function has no effect
.</para
>
1126 <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
>
1127 <para
>Pointers
and references to elements are never invalidated
.</para
>
1130 <overloaded
-method name
="at">
1131 <signature
><type
>Mapped
&
;</type
>
1132 <parameter name
="k"><paramtype
>key_type
const&
;</paramtype
></parameter
></signature
>
1133 <signature cv
="const"><type
>Mapped
const&
;</type
>
1134 <parameter name
="k"><paramtype
>key_type
const&
;</paramtype
></parameter
></signature
>
1136 <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
>
1139 <para
>An exception
object of type
<code
>std
::out_of_range
</code
> if no such element is present
.</para
>
1141 </overloaded
-method
>
1144 <method
-group name
="bucket interface">
1145 <method name
="bucket_count" cv
="const">
1146 <type
>size_type
</type
>
1148 <para
>The number of buckets
.</para
>
1151 <method name
="max_bucket_count" cv
="const">
1152 <type
>size_type
</type
>
1154 <para
>An upper bound on the number of buckets
.</para
>
1157 <method name
="bucket_size" cv
="const">
1158 <parameter name
="n">
1159 <paramtype
>size_type
</paramtype
>
1161 <type
>size_type
</type
>
1163 <para
><code
>n
<
; <methodname
>bucket_count
</methodname
>()</code
></para
>
1166 <para
>The number of elements in bucket
<code
>n
</code
>.</para
>
1169 <method name
="bucket" cv
="const">
1170 <parameter name
="k">
1171 <paramtype
>key_type
const&
;</paramtype
>
1173 <type
>size_type
</type
>
1175 <para
>The index of the bucket which would contain an element with key
<code
>k
</code
>.</para
>
1178 <para
>The
return value is less than
<code
>bucket_count()</code
></para
>
1181 <overloaded
-method name
="begin">
1183 <parameter name
="n">
1184 <paramtype
>size_type
</paramtype
>
1186 <type
>local_iterator
</type
>
1188 <signature cv
="const">
1189 <parameter name
="n">
1190 <paramtype
>size_type
</paramtype
>
1192 <type
>const_local_iterator
</type
>
1195 <para
><code
>n
</code
> shall be in the range
<code
>[0, bucket_count())</code
>.</para
>
1198 <para
>A local iterator pointing the first element in the bucket with index
<code
>n
</code
>.</para
>
1200 </overloaded
-method
>
1201 <overloaded
-method name
="end">
1203 <parameter name
="n">
1204 <paramtype
>size_type
</paramtype
>
1206 <type
>local_iterator
</type
>
1208 <signature cv
="const">
1209 <parameter name
="n">
1210 <paramtype
>size_type
</paramtype
>
1212 <type
>const_local_iterator
</type
>
1215 <para
><code
>n
</code
> shall be in the range
<code
>[0, bucket_count())</code
>.</para
>
1218 <para
>A local iterator pointing the
'one past the end' element in the bucket with index
<code
>n
</code
>.</para
>
1220 </overloaded
-method
>
1221 <method name
="cbegin" cv
="const">
1222 <parameter name
="n">
1223 <paramtype
>size_type
</paramtype
>
1225 <type
>const_local_iterator
</type
>
1227 <para
><code
>n
</code
> shall be in the range
<code
>[0, bucket_count())</code
>.</para
>
1230 <para
>A constant local iterator pointing the first element in the bucket with index
<code
>n
</code
>.</para
>
1233 <method name
="cend">
1234 <parameter name
="n">
1235 <paramtype
>size_type
</paramtype
>
1237 <type
>const_local_iterator
</type
>
1239 <para
><code
>n
</code
> shall be in the range
<code
>[0, bucket_count())</code
>.</para
>
1242 <para
>A constant local iterator pointing the
'one past the end' element in the bucket with index
<code
>n
</code
>.</para
>
1246 <method
-group name
="hash policy">
1247 <method name
="load_factor" cv
="const">
1250 <para
>The average number of elements per bucket
.</para
>
1253 <method name
="max_load_factor" cv
="const">
1256 <para
>Returns the current maximum load factor
.</para
>
1259 <method name
="max_load_factor">
1260 <parameter name
="z">
1261 <paramtype
>float</paramtype
>
1265 <para
>Changes the container
's maximum load factor, using <code>z</code> as a hint.</para>
1268 <method name="rehash">
1269 <parameter name="n">
1270 <paramtype>size_type</paramtype>
1274 <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>
1275 <para>Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.</para>
1278 <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
>
1281 <method name
="reserve">
1282 <parameter name
="n">
1283 <paramtype
>size_type
</paramtype
>
1287 <para
>Invalidates iterators
, and changes the order of elements
. Pointers
and references to elements are not invalidated
.</para
>
1290 <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>
1294 <free-function-group name="Equality Comparisons">
1295 <function name="operator==">
1297 <?php echo $template_value; ?>
1298 <template-type-parameter name="Hash">
1299 </template-type-parameter>
1300 <template-type-parameter name="Pred">
1301 </template-type-parameter>
1302 <template-type-parameter name="Alloc">
1303 </template-type-parameter>
1305 <parameter name="x">
1306 <paramtype><?php echo $full_type; ?> const&</paramtype>
1308 <parameter name="y">
1309 <paramtype><?php echo $full_type; ?> const&</paramtype>
1313 <?php if($equivalent_keys): ?>
1314 <para>Return <code>true</code> if <code>x.size() ==
1315 y.size</code> and for every equivalent key group in
1316 <code>x</code>, there is a group in <code>y</code>
1317 for the same key, which is a permutation (using
1318 <code>operator==</code> to compare the value types).
1321 <para>Return <code>true</code> if <code>x.size() ==
1322 y.size</code> and for every element in <code>x</code>,
1323 there is an element in <code>y</code> with the same
1324 for the same key, with an equal value (using
1325 <code>operator==</code> to compare the value types).
1330 <para>The behavior of this function was changed to match
1331 the C++11 standard in Boost 1.48.</para>
1332 <para>Behavior is undefined if the two containers don't have
1333 equivalent equality predicates
.</para
>
1336 <function name
="operator!=">
1338 <?php
echo $template_value; ?
>
1339 <template
-type
-parameter name
="Hash">
1340 </template
-type
-parameter
>
1341 <template
-type
-parameter name
="Pred">
1342 </template
-type
-parameter
>
1343 <template
-type
-parameter name
="Alloc">
1344 </template
-type
-parameter
>
1346 <parameter name
="x">
1347 <paramtype
><?php
echo $full_type; ?
> const&
;</paramtype
>
1349 <parameter name
="y">
1350 <paramtype
><?php
echo $full_type; ?
> const&
;</paramtype
>
1354 <?php
if($equivalent_keys): ?
>
1355 <para
>Return <code
>false</code
> if <code
>x
.size() ==
1356 y
.size
</code
> and for every equivalent key group in
1357 <code
>x
</code
>, there is a group in
<code
>y
</code
>
1358 for the same key
, which is a
permutation (using
1359 <code
>operator
==</code
> to compare the value types
).
1362 <para
>Return <code
>false</code
> if <code
>x
.size() ==
1363 y
.size
</code
> and for every element in
<code
>x
</code
>,
1364 there is an element in
<code
>y
</code
> with the same
1365 for the same key
, with an equal
value (using
1366 <code
>operator
==</code
> to compare the value types
).
1371 <para
>The behavior of this
function was changed to match
1372 the C++
11 standard in Boost
1.48.</para
>
1373 <para
>Behavior is undefined
if the two containers don
't have
1374 equivalent equality predicates.</para>
1377 </free-function-group>
1378 <free-function-group name="swap">
1379 <function name="swap">
1381 <?php echo $template_value; ?>
1382 <template-type-parameter name="Hash">
1383 </template-type-parameter>
1384 <template-type-parameter name="Pred">
1385 </template-type-parameter>
1386 <template-type-parameter name="Alloc">
1387 </template-type-parameter>
1389 <parameter name="x">
1390 <paramtype><?php echo $full_type; ?>&</paramtype>
1392 <parameter name="y">
1393 <paramtype><?php echo $full_type; ?>&</paramtype>
1397 <para><code>x.swap(y)</code></para>
1400 <para>Swaps the contents of <code>x</code> and <code>y</code>.</para>
1401 <para>If <code>Allocator::propagate_on_container_swap</code> is declared and
1402 <code>Allocator::propagate_on_container_swap::value</code> is true then the
1403 containers' allocators are swapped
. Otherwise
, swapping with unequal allocators
1404 results in undefined behavior
.</para
>
1407 <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>
1410 <para>The exception specifications aren't quite the same
as the C++
11 standard
, as
1411 the equality predieate
and hash
function are swapped using their copy constructors
.</para
>
1414 </free
-function-group
>
1421 Copyright Daniel James
2006-2009
1422 Distributed under the Boost Software License
, Version
1.0. (See accompanying
1423 file LICENSE_1_0
.txt
or copy at http
://www.boost.org/LICENSE_1_0.txt)
1424 --><library
-reference
>
1425 <header name
="boost/unordered_set.hpp">
1426 <namespace name
="boost">
1428 echo_unordered_docs(false, false);
1429 echo_unordered_docs(false, true);
1433 <header name
="boost/unordered_map.hpp">
1434 <namespace name
="boost">
1436 echo_unordered_docs(true, false);
1437 echo_unordered_docs(true, true);
1441 </library
-reference
>