Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
unordered_map< TKey, TValue, MAX_SIZE_, MAX_BUCKETS_, THash, TKeyEqual > Class Template Reference
A templated unordered_map implementation that uses a fixed size buffer. More...
#include <unordered_map.h>
Inherits iunordered_map< TKey, TValue, THash, TKeyEqual >.
Public Member Functions | |
unordered_map () | |
Default constructor. | |
unordered_map (const unordered_map &other) | |
Copy constructor. | |
template<typename TIterator > | |
unordered_map (TIterator first_, TIterator last_) | |
Constructor, from an iterator range. | |
~unordered_map () | |
Destructor. | |
unordered_map & | operator= (const unordered_map &rhs) |
Assignment operator. | |
iterator | begin () |
Returns an iterator to the beginning of the unordered_map. | |
const_iterator | begin () const |
Returns a const_iterator to the beginning of the unordered_map. | |
local_iterator | begin (size_t i) |
Returns an iterator to the beginning of the unordered_map bucket. | |
local_const_iterator | begin (size_t i) const |
Returns a const_iterator to the beginning of the unordered_map bucket. | |
const_iterator | cbegin () const |
Returns a const_iterator to the beginning of the unordered_map. | |
local_const_iterator | cbegin (size_t i) const |
Returns a const_iterator to the beginning of the unordered_map bucket. | |
iterator | end () |
Returns an iterator to the end of the unordered_map. | |
const_iterator | end () const |
Returns a const_iterator to the end of the unordered_map. | |
local_iterator | end (size_t i) |
Returns an iterator to the end of the unordered_map bucket. | |
local_const_iterator | end (size_t i) const |
Returns a const_iterator to the end of the unordered_map bucket. | |
const_iterator | cend () const |
Returns a const_iterator to the end of the unordered_map. | |
local_const_iterator | cend (size_t i) const |
Returns a const_iterator to the end of the unordered_map bucket. | |
size_type | get_bucket_index (key_parameter_t key) const |
Returns the bucket index for the key. | |
size_type | bucket_size (key_parameter_t key) const |
Returns the size of the bucket key. | |
size_type | max_bucket_count () const |
Returns the maximum number of the buckets the container can hold. | |
size_type | bucket_count () const |
Returns the number of the buckets the container holds. | |
mapped_type & | operator[] (key_parameter_t key) |
Returns a reference to the value at index 'key'. | |
mapped_type & | at (key_parameter_t key) |
Returns a reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::unordered_map_out_of_range if the key is not in the range. | |
const mapped_type & | at (key_parameter_t key) const |
Returns a const reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::unordered_map_out_of_range if the key is not in the range. | |
void | assign (TIterator first_, TIterator last_) |
Assigns values to the unordered_map. | |
std::pair< iterator, bool > | insert (const value_type &key_value_pair) |
Inserts a value to the unordered_map. | |
iterator | insert (const_iterator position, const value_type &key_value_pair) |
Inserts a value to the unordered_map. | |
void | insert (TIterator first_, TIterator last_) |
Inserts a range of values to the unordered_map. | |
size_t | erase (key_parameter_t key) |
Erases an element. | |
iterator | erase (const_iterator ielement) |
Erases an element. | |
iterator | erase (const_iterator first_, const_iterator last_) |
Erases a range of elements. | |
void | clear () |
Clears the unordered_map. | |
size_t | count (key_parameter_t key) const |
Counts an element. | |
iterator | find (key_parameter_t key) |
Finds an element. | |
const_iterator | find (key_parameter_t key) const |
Finds an element. | |
std::pair< iterator, iterator > | equal_range (key_parameter_t key) |
Returns a range containing all elements with key key in the container. | |
std::pair< const_iterator, const_iterator > | equal_range (key_parameter_t key) const |
Returns a range containing all elements with key key in the container. | |
size_type | size () const |
Gets the size of the unordered_map. | |
size_type | max_size () const |
Gets the maximum possible size of the unordered_map. | |
bool | empty () const |
Checks to see if the unordered_map is empty. | |
bool | full () const |
Checks to see if the unordered_map is full. | |
size_t | available () const |
Returns the remaining capacity. | |
float | load_factor () const |
Returns the load factor = size / bucket_count. | |
hasher | hash_function () const |
Returns the function that hashes the keys. | |
key_equal | key_eq () const |
Returns the function that compares the keys. | |
Protected Member Functions | |
void | initialise () |
Initialise the unordered_map. |
Detailed Description
template<typename TKey, typename TValue, const size_t MAX_SIZE_, const size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = std::equal_to<TKey>>
class etl::unordered_map< TKey, TValue, MAX_SIZE_, MAX_BUCKETS_, THash, TKeyEqual >
A templated unordered_map implementation that uses a fixed size buffer.
Definition at line 1318 of file unordered_map.h.
Constructor & Destructor Documentation
unordered_map | ( | ) |
Default constructor.
Definition at line 1332 of file unordered_map.h.
unordered_map | ( | const unordered_map< TKey, TValue, MAX_SIZE_, MAX_BUCKETS_, THash, TKeyEqual > & | other ) |
Copy constructor.
Definition at line 1341 of file unordered_map.h.
unordered_map | ( | TIterator | first_, |
TIterator | last_ | ||
) |
Constructor, from an iterator range.
- Template Parameters:
-
TIterator The iterator type.
- Parameters:
-
first The iterator to the first element. last The iterator to the last element + 1.
Definition at line 1354 of file unordered_map.h.
~unordered_map | ( | ) |
Destructor.
Definition at line 1363 of file unordered_map.h.
Member Function Documentation
void assign | ( | TIterator | first_, |
TIterator | last_ | ||
) | [inherited] |
Assigns values to the unordered_map.
If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map does not have enough free space. If asserts or exceptions are enabled, emits unordered_map_iterator if the iterators are reversed.
- Parameters:
-
first The iterator to the first element. last The iterator to the last element + 1.
Definition at line 746 of file unordered_map.h.
mapped_type& at | ( | key_parameter_t | key ) | [inherited] |
Returns a reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::unordered_map_out_of_range if the key is not in the range.
- Parameters:
-
key The key.
- Returns:
- A reference to the value at index 'key'
Definition at line 674 of file unordered_map.h.
const mapped_type& at | ( | key_parameter_t | key ) | const [inherited] |
Returns a const reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::unordered_map_out_of_range if the key is not in the range.
- Parameters:
-
key The key.
- Returns:
- A const reference to the value at index 'key'
Definition at line 709 of file unordered_map.h.
size_t available | ( | ) | const [inherited] |
Returns the remaining capacity.
- Returns:
- The remaining capacity.
Definition at line 1148 of file unordered_map.h.
local_iterator begin | ( | size_t | i ) | [inherited] |
Returns an iterator to the beginning of the unordered_map bucket.
- Returns:
- An iterator to the beginning of the unordered_map bucket.
Definition at line 514 of file unordered_map.h.
iterator begin | ( | ) | [inherited] |
Returns an iterator to the beginning of the unordered_map.
- Returns:
- An iterator to the beginning of the unordered_map.
Definition at line 487 of file unordered_map.h.
local_const_iterator begin | ( | size_t | i ) | const [inherited] |
Returns a const_iterator to the beginning of the unordered_map bucket.
- Returns:
- A const iterator to the beginning of the unordered_map bucket.
Definition at line 523 of file unordered_map.h.
const_iterator begin | ( | ) | const [inherited] |
Returns a const_iterator to the beginning of the unordered_map.
- Returns:
- A const iterator to the beginning of the unordered_map.
Definition at line 496 of file unordered_map.h.
size_type bucket_count | ( | ) | const [inherited] |
Returns the number of the buckets the container holds.
- Returns:
- The number of the buckets the container holds.
Definition at line 624 of file unordered_map.h.
size_type bucket_size | ( | key_parameter_t | key ) | const [inherited] |
Returns the size of the bucket key.
- Returns:
- The bucket size of the bucket key.
Definition at line 604 of file unordered_map.h.
const_iterator cbegin | ( | ) | const [inherited] |
Returns a const_iterator to the beginning of the unordered_map.
- Returns:
- A const iterator to the beginning of the unordered_map.
Definition at line 505 of file unordered_map.h.
local_const_iterator cbegin | ( | size_t | i ) | const [inherited] |
Returns a const_iterator to the beginning of the unordered_map bucket.
- Returns:
- A const iterator to the beginning of the unordered_map bucket.
Definition at line 532 of file unordered_map.h.
const_iterator cend | ( | ) | const [inherited] |
Returns a const_iterator to the end of the unordered_map.
- Returns:
- A const iterator to the end of the unordered_map.
Definition at line 559 of file unordered_map.h.
local_const_iterator cend | ( | size_t | i ) | const [inherited] |
Returns a const_iterator to the end of the unordered_map bucket.
- Returns:
- A const iterator to the end of the unordered_map bucket.
Definition at line 586 of file unordered_map.h.
void clear | ( | ) | [inherited] |
Clears the unordered_map.
Definition at line 987 of file unordered_map.h.
size_t count | ( | key_parameter_t | key ) | const [inherited] |
Counts an element.
- Parameters:
-
key The key to search for.
- Returns:
- 1 if the key exists, otherwise 0.
Definition at line 997 of file unordered_map.h.
bool empty | ( | ) | const [inherited] |
Checks to see if the unordered_map is empty.
Definition at line 1131 of file unordered_map.h.
iterator end | ( | ) | [inherited] |
Returns an iterator to the end of the unordered_map.
- Returns:
- An iterator to the end of the unordered_map.
Definition at line 541 of file unordered_map.h.
const_iterator end | ( | ) | const [inherited] |
Returns a const_iterator to the end of the unordered_map.
- Returns:
- A const iterator to the end of the unordered_map.
Definition at line 550 of file unordered_map.h.
local_iterator end | ( | size_t | i ) | [inherited] |
Returns an iterator to the end of the unordered_map bucket.
- Returns:
- An iterator to the end of the unordered_map bucket.
Definition at line 568 of file unordered_map.h.
local_const_iterator end | ( | size_t | i ) | const [inherited] |
Returns a const_iterator to the end of the unordered_map bucket.
- Returns:
- A const iterator to the end of the unordered_map bucket.
Definition at line 577 of file unordered_map.h.
std::pair<iterator, iterator> equal_range | ( | key_parameter_t | key ) | [inherited] |
Returns a range containing all elements with key key in the container.
The range is defined by two iterators, the first pointing to the first element of the wanted range and the second pointing past the last element of the range.
- Parameters:
-
key The key to search for.
- Returns:
- An iterator pair to the range of elements if the key exists, otherwise end().
Definition at line 1078 of file unordered_map.h.
std::pair<const_iterator, const_iterator> equal_range | ( | key_parameter_t | key ) | const [inherited] |
Returns a range containing all elements with key key in the container.
The range is defined by two iterators, the first pointing to the first element of the wanted range and the second pointing past the last element of the range.
- Parameters:
-
key The key to search for.
- Returns:
- A const iterator pair to the range of elements if the key exists, otherwise end().
Definition at line 1099 of file unordered_map.h.
size_t erase | ( | key_parameter_t | key ) | [inherited] |
Erases an element.
- Parameters:
-
key The key to erase.
- Returns:
- The number of elements erased. 0 or 1.
Definition at line 871 of file unordered_map.h.
iterator erase | ( | const_iterator | ielement ) | [inherited] |
Erases an element.
- Parameters:
-
ielement Iterator to the element.
Definition at line 905 of file unordered_map.h.
iterator erase | ( | const_iterator | first_, |
const_iterator | last_ | ||
) | [inherited] |
Erases a range of elements.
The range includes all the elements between first and last, including the element pointed by first, but not the one pointed to by last.
- Parameters:
-
first Iterator to the first element. last Iterator to the last element.
Definition at line 936 of file unordered_map.h.
const_iterator find | ( | key_parameter_t | key ) | const [inherited] |
Finds an element.
- Parameters:
-
key The key to search for.
- Returns:
- An iterator to the element if the key exists, otherwise end().
Definition at line 1041 of file unordered_map.h.
iterator find | ( | key_parameter_t | key ) | [inherited] |
Finds an element.
- Parameters:
-
key The key to search for.
- Returns:
- An iterator to the element if the key exists, otherwise end().
Definition at line 1007 of file unordered_map.h.
bool full | ( | ) | const [inherited] |
Checks to see if the unordered_map is full.
Definition at line 1139 of file unordered_map.h.
size_type get_bucket_index | ( | key_parameter_t | key ) | const [inherited] |
Returns the bucket index for the key.
- Returns:
- The bucket index for the key.
Definition at line 595 of file unordered_map.h.
hasher hash_function | ( | ) | const [inherited] |
Returns the function that hashes the keys.
- Returns:
- The function that hashes the keys..
Definition at line 1166 of file unordered_map.h.
void initialise | ( | ) | [protected, inherited] |
Initialise the unordered_map.
Definition at line 1209 of file unordered_map.h.
std::pair<iterator, bool> insert | ( | const value_type & | key_value_pair ) | [inherited] |
Inserts a value to the unordered_map.
If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map is already full.
- Parameters:
-
value The value to insert.
Definition at line 767 of file unordered_map.h.
iterator insert | ( | const_iterator | position, |
const value_type & | key_value_pair | ||
) | [inherited] |
Inserts a value to the unordered_map.
If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map is already full.
- Parameters:
-
position The position to insert at. value The value to insert.
Definition at line 845 of file unordered_map.h.
void insert | ( | TIterator | first_, |
TIterator | last_ | ||
) | [inherited] |
Inserts a range of values to the unordered_map.
If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map does not have enough free space.
- Parameters:
-
position The position to insert at. first The first element to add. last The last + 1 element to add.
Definition at line 858 of file unordered_map.h.
key_equal key_eq | ( | ) | const [inherited] |
Returns the function that compares the keys.
- Returns:
- The function that compares the keys..
Definition at line 1175 of file unordered_map.h.
float load_factor | ( | ) | const [inherited] |
Returns the load factor = size / bucket_count.
- Returns:
- The load factor = size / bucket_count.
Definition at line 1157 of file unordered_map.h.
size_type max_bucket_count | ( | ) | const [inherited] |
Returns the maximum number of the buckets the container can hold.
- Returns:
- The maximum number of the buckets the container can hold.
Definition at line 615 of file unordered_map.h.
size_type max_size | ( | ) | const [inherited] |
Gets the maximum possible size of the unordered_map.
Definition at line 1123 of file unordered_map.h.
unordered_map& operator= | ( | const unordered_map< TKey, TValue, MAX_SIZE_, MAX_BUCKETS_, THash, TKeyEqual > & | rhs ) |
Assignment operator.
Definition at line 1371 of file unordered_map.h.
mapped_type& operator[] | ( | key_parameter_t | key ) | [inherited] |
Returns a reference to the value at index 'key'.
- Parameters:
-
key The key.
- Returns:
- A reference to the value at index 'key'
Definition at line 634 of file unordered_map.h.
size_type size | ( | ) | const [inherited] |
Gets the size of the unordered_map.
Definition at line 1115 of file unordered_map.h.
Generated on Tue Jul 12 2022 14:05:55 by
