Overview of Functions
The containers are defined in headers named after the names of the containers, e.g. unordered_set
is defined in header
. All containers satisfy the requirements of the Container concept, which means they have begin
, end
, size
, max_size
, empty
, and swap
methods.
unordered_set (C++11) |
unordered_map (C++11) |
unordered_multiset (C++11) |
unordered_multimap (C++11) |
Description | |
---|---|---|---|---|---|
(constructor) | (constructor) | (constructor) | (constructor) | Constructs the container from variety of sources | |
(destructor) | (destructor) | (destructor) | (destructor) | Destructs the set and the contained elements | |
operator= |
operator= |
operator= |
operator= |
Assigns values to the container | |
get_allocator |
get_allocator |
get_allocator |
get_allocator |
Returns the allocator used to allocate memory for the elements | |
Element access | at |
Accesses specified element with bounds checking. | |||
operator |
Accesses specified element without bounds checking. | ||||
Iterators | begin |
begin |
begin |
begin |
Returns an iterator to the beginning of the container |
end |
end |
end |
end |
Returns an iterator to the end of the container | |
Capacity | empty |
empty |
empty |
empty |
Checks whether the container is empty |
size |
size |
size |
size |
Returns number of elements in the container. | |
max_size |
max_size |
max_size |
max_size |
Returns the maximum possible number of elements in the container | |
Modifiers | clear |
clear |
clear |
clear |
Clears the contents. |
insert |
insert |
insert |
insert |
Inserts elements. | |
emplace |
emplace |
emplace |
emplace |
Constructs elements in-place (C++11) | |
emplace_hint |
emplace_hint |
emplace_hint |
emplace_hint |
Constructs elements in-place using a hint (C++11) | |
erase |
erase |
erase |
erase |
Erases elements. | |
swap |
swap |
swap |
swap |
Swaps the contents with another container. | |
Lookup | count |
count |
count |
count |
Returns the number of elements matching specific key. |
find |
find |
find |
find |
Finds an element with specific key. | |
equal_range |
equal_range |
equal_range |
equal_range |
Returns a range of elements matching specific key. | |
Bucket interface | ... | ||||
Hash policy | ... | ||||
Observers | hash_function |
hash_function |
hash_function |
hash_function |
Returns the function used to create hash of a key |
key_eq |
key_eq |
key_eq |
key_eq |
Returns key comparison function. |
Read more about this topic: Unordered Associative Containers (C++)
Famous quotes containing the word functions:
“Let us stop being afraid. Of our own thoughts, our own minds. Of madness, our own or others. Stop being afraid of the mind itself, its astonishing functions and fandangos, its complications and simplifications, the wonderful operation of its machinerymore wonderful because it is not machinery at all or predictable.”
—Kate Millett (b. 1934)