Unigine::HashMap Class
Header: | #include <UnigineHashMap.h> |
HashMap Class
Members
HashMap ( ) #
Default constructor that produces an empty hash map.HashMap ( std::initializer_list<Pair<Key,Type>> list ) #
Constructor. Creates a hash map from given key-value pairs.Arguments
- std::initializer_list<Pair<Key,Type>> list - List of pairs.
HashMap ( const HashMap& o ) #
Constructor. Creates a hash map by copying a source hash map.Arguments
- const HashMap& o - Hash map.
HashMap ( HashMap&& o ) #
Constructor. Creates a hash map by copying a source hash map.Arguments
- HashMap&& o - Hash map.
HashMap<Key, Type, Counter> & operator= ( const HashMap& o ) #
Assignment operator for the hash map.Arguments
- const HashMap& o - Hash map.
HashMap<Key, Type, Counter> & operator= ( HashMap&& o ) #
Assignment operator for the hash map.Arguments
- HashMap&& o - Hash map.
Iterator append ( const Key& key, const Type& value ) #
Appends an item with a given key and value to the hash map.Arguments
- const Key& key - Key.
- const Type& value - Value.
Return value
Item iterator.Iterator append ( const Key& key, Type&& value ) #
Appends an item with a given key and value to the hash map.Arguments
- const Key& key - Key.
- Type&& value - Value.
Return value
Item iterator.Iterator append ( Key&& key, const Type& value ) #
Appends an item with a given key and value to the hash map.Arguments
- Key&& key - Key.
- const Type& value - Value.
Return value
Item iterator.Iterator append ( Key&& key, Type&& value ) #
Appends an item with a given key and value to the hash map.Arguments
- Key&& key - Key.
- Type&& value - Value.
Return value
Item iterator.void append ( const HashMap& o ) #
Appends a given hash map to the current one.Arguments
- const HashMap& o - Hash map.
void append ( HashMap&& o ) #
Appends a given hash map to the current one.Arguments
- HashMap&& o - Hash map.
Iterator insert ( const Key& key, const Type& value ) #
Inserts an item with a given key and value into the hash map.Arguments
- const Key& key - Key.
- const Type& value - Value.
Return value
Item iterator.Iterator insert ( const Key& key, Type&& value ) #
Inserts an item with a given key and value into the hash map.Arguments
- const Key& key - Key.
- Type&& value - Value.
Return value
Item iterator.Iterator insert ( Key&& key, const Type& value ) #
Inserts an item with a given key and value into the hash map.Arguments
- Key&& key - Key.
- const Type& value - Value.
Return value
Item iterator.Iterator insert ( Key&& key, Type&& value ) #
Inserts an item with a given key and value into the hash map.Arguments
- Key&& key - Key.
- Type&& value - Value.
Return value
Item iterator.void insert ( const HashMap& o ) #
Inserts a given hash map into the current one.Arguments
- const HashMap& o - Hash map.
void insert ( HashMap&& o ) #
Inserts a given hash map into the current one.Arguments
- HashMap&& o - Hash map.
Type & append ( const Key& key ) #
Appends an item with a specified key to the hash map. The item value is default-constructed.Arguments
- const Key& key - Key.
Return value
Added item value.Type & append ( Key&& key ) #
Appends an item with a specified key to the hash map. The item value is default-constructed.Arguments
- Key&& key - Key.
Return value
Added item value.Type & insert ( const Key& key ) #
Inserts an item with a specified key into the hash map. The item value is default-constructed.Arguments
- const Key& key - Key.
Return value
Inserted item value.Type & insert ( Key&& key ) #
Inserts an item with a specified key into the hash map. The item value is default-constructed.Arguments
- Key&& key - Key.
Return value
Inserted item value.Type & emplace ( const Key& key, Args&& args ) #
Inserts an item with a specified key into the hash map. The new item value is constructed in-place with the given arguments avoiding unnecessary copying.Arguments
- const Key& key - Key.
- Args&& args - Arguments for an item value constructor.
Return value
Inserted item value.Type & emplace ( Key&& key, Args&& args ) #
Inserts an item with a specified key into the hash map. The new item value is constructed in-place with the given arguments avoiding unnecessary copying.Arguments
- Key&& key - Key.
- Args&& args - Arguments for an item value constructor.
Return value
Inserted item value.Type take ( const Key& key, const Type& value ) #
Removes an item with a specified key from the hash map and returns an item value. If there is no item with the specified key, a default value is returned.Arguments
- const Key& key - Key.
- const Type& value - Default value.
Return value
Removed item value.Type take ( const Key& key ) #
Removes an item with a specified key from the hash map and returns its value. If there is no item with the specified key, a default-constructed value is returned.Arguments
- const Key& key - Key.
Return value
Removed item value.Type take ( const Iterator& it ) #
Removes an item from the hash map by its iterator and returns an item value. If there is no such item, a default-constructed value is returned.Arguments
- const Iterator& it - Item iterator.
Return value
Removed item value.Type take ( const ConstIterator& it ) #
Removes an item from the hash map by its iterator and returns an item value. If there is no such item, a default-constructed value is returned.Arguments
- const ConstIterator& it - Item iterator.
Return value
Removed item value.Type & operator[] ( const Key& key ) #
Hash map item access.Arguments
- const Key& key - Key.
Return value
Accessed item value.Type & operator[] ( Key&& key ) #
Hash map item access.Arguments
- Key&& key - Key.
Return value
Accessed item value.const Type & operator[] ( const Key& key ) const#
Hash map item access.Arguments
- const Key& key - Key.
Return value
Accessed item value.Type & get ( Key&& key ) #
Returns a value by a specified key. If there is no item with the key, inserts a new value.Arguments
- Key&& key - Key.
Return value
Value.Type & get ( const Key& key ) #
Returns a value by a specified key. If there is no item with the key, inserts a new value.Arguments
- const Key& key - Key.
Return value
Value.const Type & get ( const T& key ) const#
Returns a value by a specified key.Arguments
- const T& key - Key.
Return value
Value.const Type & get ( const T& key, const Type& value ) const#
Returns a value by a specified key. If there is no item with the key, the default value is returned.Arguments
- const T& key - Key.
- const Type& value - Default value.
Return value
Value.bool contains ( const T& key, const Type& value ) const#
Checks if an item with a specified key and value exists in the hash map.Arguments
- const T& key - Key.
- const Type& value - Value.
Return value
Returns 1 if an item exists; otherwise, 0 is returned.Iterator findData ( const Type& t ) #
Searches for an item with a specified value in the hash map.Arguments
- const Type& t - Value.
Return value
Item iterator.ConstIterator findData ( const Type& t ) const#
Searches for an item with a specified value in the hash map.Arguments
- const Type& t - Value.
Return value
Item iterator.Type value ( const T& key ) const#
Returns a value with a specified key from the hash map. If there is no such key, returns a default-constructed value.Arguments
- const T& key - Key.
Return value
Value.Type value ( const T& key, const Type& def ) const#
Returns a value with a specified key from the hash map. If there is no such key, returns a default value.Arguments
- const T& key - Key.
- const Type& def - Default value.
Return value
Value.const Type & valueRef ( const T& key, const Type& def ) const#
Returns a value with a specified key from the hash map. If there is no such key, returns a default value.Arguments
- const T& key - Key.
- const Type& def - Default value.
Return value
Value.int values ( ) const#
Returns a vector of all values of the hash map.Return value
Vector of hash map values.void getValues ( Vector<Type>& values ) const#
Appends hash map values to a given vector.Arguments
- Vector<Type>& values - Vector of hash map values.
void getPairs ( Vector<Pair<Key,Type >>& pairs ) const#
Appends hash map key-value pairs to a given vector.Arguments
bool operator== ( const HashMap& o ) const#
Checks if two hash maps are equal. The hash maps are considered equal if their key-value pairs are the same.Arguments
- const HashMap& o - Hash map.
Return value
Returns 1 if hash maps are equal; otherwise, 0 is returned.bool operator!= ( const HashMap& o ) const#
Checks if two hash maps are not equal. The hash maps are considered equal if their key-value pairs are the same.Arguments
- const HashMap& o - Hash map.
Return value
Returns 1 if hash maps are not equal; otherwise, 0 is returned.Last update:
2022-01-21
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)