DASH  0.3.0
dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType > Class Template Reference

Usage examples: More...

#include <UnorderedMap.h>

Public Types

typedef Key key_type
 
typedef Mapped mapped_type
 
typedef Hash hasher
 
typedef Pred key_equal
 
typedef dash::default_index_t index_type
 
typedef dash::default_index_t difference_type
 
typedef dash::default_size_t size_type
 
typedef std::pair< const key_type, mapped_type > value_type
 
typedef dash::container_traits< self_type >::local_type local_type
 
typedef GlobHeapPtr< value_type, glob_mem_typepointer
 
typedef GlobHeapPtr< const value_type, glob_mem_typeconst_pointer
 
typedef GlobSharedRef< value_type, GlobHeapPtr< value_type, glob_mem_type > > reference
 
typedef GlobSharedRef< value_type const, GlobHeapPtr< value_type, glob_mem_type > > const_reference
 
typedef reference::template rebind< mapped_type >::other mapped_type_reference
 
typedef const_reference::template rebind< mapped_type >::other const_mapped_type_reference
 
typedef glob_mem_type::global_iterator node_iterator
 
typedef glob_mem_type::const_global_iterator const_node_iterator
 
typedef glob_mem_type::local_iterator local_node_iterator
 
typedef glob_mem_type::const_local_iterator const_local_node_iterator
 
typedef glob_mem_type::reverse_global_iterator reverse_node_iterator
 
typedef glob_mem_type::const_reverse_global_iterator const_reverse_node_iterator
 
typedef glob_mem_type::reverse_local_iterator reverse_local_node_iterator
 
typedef glob_mem_type::const_reverse_local_iterator const_reverse_local_node_iterator
 
typedef glob_mem_type::local_iterator local_node_pointer
 
typedef glob_mem_type::const_local_iterator const_local_node_pointer
 
typedef UnorderedMapGlobIter< Key, Mapped, Hash, Pred, glob_mem_typeiterator
 
typedef UnorderedMapGlobIter< Key, Mapped, Hash, Pred, glob_mem_typeconst_iterator
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > local_pointer
 
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > const_local_pointer
 
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > local_iterator
 
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > const_local_iterator
 
typedef std::reverse_iterator< local_iteratorreverse_local_iterator
 
typedef std::reverse_iterator< const_local_iteratorconst_reverse_local_iterator
 
typedef glob_mem_type::local_reference local_reference
 
typedef glob_mem_type::const_local_reference const_local_reference
 
typedef dash::Array< size_type, int, dash::CSRPattern< 1, dash::ROW_MAJOR, int > > local_sizes_map
 

Public Member Functions

constexpr Teamteam () const noexcept
 The team containing all units accessing this map. More...
 
const glob_mem_typeglobmem () const
 Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this container instance. More...
 
void barrier ()
 Synchronize changes on local and global memory space of the map since initialization or the last call of its barrier method with global memory. More...
 
bool allocate (size_type nelem=0, dash::Team &team=dash::Team::All())
 Allocate memory for this container in global memory. More...
 
void deallocate ()
 Free global memory allocated by this container instance. More...
 
iteratorbegin () noexcept
 Global iterator to the beginning of the map. More...
 
const_iteratorbegin () const noexcept
 Global const iterator to the beginning of the map. More...
 
const_iteratorcbegin () const noexcept
 Global const iterator to the beginning of the map. More...
 
iteratorend () noexcept
 Global iterator to the end of the map. More...
 
const_iteratorend () const noexcept
 Global const iterator to the end of the map. More...
 
const_iteratorcend () const noexcept
 Global const iterator to the end of the map. More...
 
local_iteratorlbegin () noexcept
 Local iterator to the local beginning of the map. More...
 
const_local_iteratorlbegin () const noexcept
 Const local iterator to the local beginning of the map. More...
 
const_local_iteratorclbegin () const noexcept
 Const local iterator to the local beginning of the map. More...
 
local_iteratorlend () noexcept
 Local iterator to the local end of the map. More...
 
const_local_iteratorlend () const noexcept
 Local const iterator to the local end of the map. More...
 
const_local_iteratorclend () const noexcept
 Local const iterator to the local end of the map. More...
 
constexpr size_type max_size () const noexcept
 Maximum number of elements a map container can hold, e.g. More...
 
size_type size () const noexcept
 The size of the map. More...
 
size_type capacity () const noexcept
 The number of elements that can be held in currently allocated storage of the map. More...
 
bool empty () const noexcept
 Whether the map is empty. More...
 
size_type lsize () const noexcept
 The number of elements in the local part of the map. More...
 
size_type lcapacity () const noexcept
 The capacity of the local part of the map. More...
 
mapped_type_reference operator[] (const key_type &key)
 If key matches the key of an element in the container, returns a reference to its mapped value. More...
 
const_mapped_type_reference at (const key_type &key) const
 If key matches the key of an element in the container, returns a const reference to its mapped value. More...
 
mapped_type_reference at (const key_type &key)
 If key matches the key of an element in the container, returns a reference to its mapped value. More...
 
size_type count (const key_type &key) const
 Count elements with a specific key. More...
 
iterator find (const key_type &key)
 Get iterator to element with specified key. More...
 
const_iterator find (const key_type &key) const
 Get const_iterator to element with specified key. More...
 
std::pair< iterator, bool > insert (const value_type &value)
 Insert a new element as key-value pair, increasing the container size by 1. More...
 
iterator insert (const_iterator hint, const value_type &value)
 inserts value, using hint as a non-binding suggestion to where the search should start. More...
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 Insert elements in iterator range of key-value pairs, increasing the container size by the number of elements in the range. More...
 
iterator erase (const_iterator position)
 Removes and destroys single element referenced by given iterator from the container, decreasing the container size by 1. More...
 
size_type erase (const key_type &key)
 Removes and destroys elements referenced by the given key from the container, decreasing the container size by the number of elements removed. More...
 
iterator erase (const_iterator first, const_iterator last)
 Removes and destroys elements in the given range from the container, decreasing the container size by the number of elements removed. More...
 
size_type bucket (const key_type &key) const
 Returns the index of the bucket for a specified key. More...
 
size_type bucket_size (size_type bucket_index) const
 The number of elements in a specified bucket. More...
 
key_equal key_eq () const
 Returns the function that compares keys for equality. More...
 
hasher hash_function () const
 Returns the function that hashes the keys. More...
 

Public Attributes

local_type local
 Local proxy object, allows use in range-based for loops. More...
 

Detailed Description

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
class dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >

Usage examples:

// map of int (key type) to double (value type):
int myid = static_cast<int>(dash::myid());
map.insert(std::make_pair(myid, 12.3);
map.local.insert(std::make_pair(100 * myid, 12.3);

A dynamic map container with support for workload balancing.

Implemented concept:
Unordered Map Concept

Definition at line 33 of file UnorderedMapGlobIter.h.

Member Function Documentation

◆ allocate()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
bool dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::allocate ( size_type  nelem = 0,
dash::Team team = dash::Team::All() 
)

Allocate memory for this container in global memory.

Calls implicit barrier on the team associated with the container instance.

Parameters
nelemInitial global capacity of the container.
teamTeam containing all units associated with the container.

◆ at() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::at ( const key_type &  key) const

If key matches the key of an element in the container, returns a const reference to its mapped value.

Throws an exception if key does not match the key of any element in the container.

Member function operator[]() has the same behavior when an element with the key exists, but does not throw an exception when it does not.

Returns
const reference to the mapped value of the element with a key value equivalent to key.

◆ at() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::at ( const key_type &  key)

If key matches the key of an element in the container, returns a reference to its mapped value.

Throws an exception if key does not match the key of any element in the container.

Member function operator[]() has the same behavior when an element with the key exists, but does not throw an exception when it does not.

Returns
reference to the mapped value of the element with a key value equivalent to key.

◆ barrier()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::barrier ( )

Synchronize changes on local and global memory space of the map since initialization or the last call of its barrier method with global memory.

Referenced by MyHash< Key >::MyHash().

◆ begin() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::begin ( )
noexcept

Global iterator to the beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

Referenced by MyHash< Key >::MyHash().

◆ begin() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::begin ( ) const
noexcept

Global const iterator to the beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ bucket()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::bucket ( const key_type &  key) const

Returns the index of the bucket for a specified key.

Elements with keys equivalent to the specified key are always found in this bucket.

Returns
Bucket index for the specified key
Parameters
keyThe value of the key to examine

◆ bucket_size()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::bucket_size ( size_type  bucket_index) const

The number of elements in a specified bucket.

Returns
The number of elements in the bucket with the specified index
Parameters
bucket_indexThe index of the bucket to examine

◆ capacity()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::capacity ( ) const
noexcept

The number of elements that can be held in currently allocated storage of the map.

Returns
The number of elements in the map.

◆ cbegin()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::cbegin ( ) const
noexcept

Global const iterator to the beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ cend()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::cend ( ) const
noexcept

Global const iterator to the end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ clbegin()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::clbegin ( ) const
noexcept

Const local iterator to the local beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ clend()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::clend ( ) const
noexcept

Local const iterator to the local end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ count()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::count ( const key_type &  key) const

Count elements with a specific key.

Searches the container for elements with specified key and returns the number of elements found. As maps do not allow for duplicate keys, either 1 or 0 elements are matched.

Returns
1 if an element with the specified key exists in the container, otherwise 0.

Referenced by MyHash< Key >::MyHash().

◆ deallocate()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::deallocate ( )

Free global memory allocated by this container instance.

Calls implicit barrier on the team associated with the container instance.

◆ empty()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
bool dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::empty ( ) const
noexcept

Whether the map is empty.

Returns
true if size() is 0, otherwise false

◆ end() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::end ( )
noexcept

Global iterator to the end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

Referenced by MyHash< Key >::MyHash().

◆ end() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::end ( ) const
noexcept

Global const iterator to the end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ erase() [1/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase ( const_iterator  position)

Removes and destroys single element referenced by given iterator from the container, decreasing the container size by 1.

References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.

Returns
iterator to the element that follows the last element removed, or end() if the last element was removed.

◆ erase() [2/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase ( const key_type &  key)

Removes and destroys elements referenced by the given key from the container, decreasing the container size by the number of elements removed.

References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.

Returns
The number of elements removed.
Parameters
keyKey of the container element to remove.

◆ erase() [3/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase ( const_iterator  first,
const_iterator  last 
)

Removes and destroys elements in the given range from the container, decreasing the container size by the number of elements removed.

References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.

Returns
iterator to the element that follows the last element removed, or end() if the last element was removed.
Parameters
firstIterator at first element to remove.
lastIterator past the last element to remove.

◆ find() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::find ( const key_type &  key)

Get iterator to element with specified key.

The mapped value can also be accessed directly by using member functions at or operator[].

Returns
iterator to element with specified key if found, otherwise iterator to the element past the end of the container.
See also
count
at
operator[]

Referenced by MyHash< Key >::MyHash().

◆ find() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::find ( const key_type &  key) const

Get const_iterator to element with specified key.

The mapped value can also be accessed directly by using member functions at or operator[].

Returns
const_iterator to element with specified key if found, otherwise const_iterator to the element past the end of the container.
See also
count
at
operator[]

◆ globmem()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const glob_mem_type& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::globmem ( ) const

◆ hash_function()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
hasher dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::hash_function ( ) const

Returns the function that hashes the keys.

◆ insert() [1/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
std::pair<iterator, bool> dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert ( const value_type &  value)

Insert a new element as key-value pair, increasing the container size by 1.

Iterator validity:

  • All iterators in the container remain valid after the insertion unless it forces a rehash. In this case, all iterators in the container are invalidated.
  • A rehash is forced if the new container size after the insertion operation would increase above its capacity threshold.
  • References to elements in the map container remain valid in all cases, even after a rehash.
See also
operator[]
Returns
pair, with its member pair::first set to an iterator pointing to either the newly inserted element or to the element with an equivalent key in the map. The pair::second element in the pair is set to true if a new element was inserted or false if an equivalent key already existed.
Parameters
valueThe element to insert.

Referenced by MyHash< Key >::MyHash().

◆ insert() [2/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert ( const_iterator  hint,
const value_type &  value 
)

inserts value, using hint as a non-binding suggestion to where the search should start.

Iterator validity:

  • All iterators in the container remain valid after the insertion unless it forces a rehash. In this case, all iterators in the container are invalidated.
  • A rehash is forced if the new container size after the insertion operation would increase above its capacity threshold.
  • References to elements in the map container remain valid in all cases, even after a rehash.
Returns
an iterator to the inserted element, or to the element that prevented the insertion.

◆ insert() [3/3]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
template<class InputIterator >
void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert ( InputIterator  first,
InputIterator  last 
)

Insert elements in iterator range of key-value pairs, increasing the container size by the number of elements in the range.

Iterator validity:

  • All iterators in the container remain valid after the insertion unless it forces a rehash. In this case, all iterators in the container are invalidated.
  • A rehash is forced if the new container size after the insertion operation would increase above its capacity threshold.
  • References to elements in the map container remain valid in all cases, even after a rehash.

◆ key_eq()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
key_equal dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::key_eq ( ) const

Returns the function that compares keys for equality.

◆ lbegin() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lbegin ( )
noexcept

Local iterator to the local beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ lbegin() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lbegin ( ) const
noexcept

Const local iterator to the local beginning of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ lcapacity()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lcapacity ( ) const
noexcept

The capacity of the local part of the map.

Returns
The number of allocated elements in the map that are local to the calling unit.

◆ lend() [1/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lend ( )
noexcept

Local iterator to the local end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ lend() [2/2]

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
const_local_iterator& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lend ( ) const
noexcept

Local const iterator to the local end of the map.

After inserting and removing elements, begin and end iterators may differ between units until the next call of commit().

◆ lsize()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::lsize ( ) const
noexcept

The number of elements in the local part of the map.

Returns
The number of elements in the map that are local to the calling unit.

Referenced by MyHash< Key >::MyHash().

◆ max_size()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
constexpr size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::max_size ( ) const
noexcept

Maximum number of elements a map container can hold, e.g.

due to system limitations. The maximum size is not guaranteed.

◆ operator[]()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::operator[] ( const key_type &  key)

If key matches the key of an element in the container, returns a reference to its mapped value.

If key does not match the key of any element in the container, inserts a new element with that key and returns a reference to its mapped value. Notice that this always increases the container size by one, even if no mapped value is assigned to the element. The element is then constructed using its default constructor.

Equivalent to:

(*(
(this->insert(std::make_pair(key, mapped_type())))
.first)
).second;

Member function at() has the same behavior when an element with the key exists, but throws an exception when it does not.

Returns
reference to the mapped value of the element with a key value equivalent to key.

◆ size()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::size ( ) const
noexcept

The size of the map.

Returns
The number of elements in the map.

Referenced by MyHash< Key >::MyHash().

◆ team()

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
constexpr Team& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::team ( ) const
noexcept

The team containing all units accessing this map.

Returns
A reference to the Team containing the units associated with the container instance.

Member Data Documentation

◆ local

template<typename Key, typename Mapped, typename Hash = dash::HashLocal<Key>, typename Pred = std::equal_to<Key>, typename LocalMemType = HostSpace>
local_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::local

Local proxy object, allows use in range-based for loops.

Definition at line 232 of file UnorderedMap.h.


The documentation for this class was generated from the following files: