Container that stores key-value pairs by hashing the key to determine the position in the container where the elements will be stored. More...
Public Member Functions | |
hasher | hash_funct () const |
Returns the hash functor. | |
key_equal | key_eq () const |
Returns the comparison functor. | |
allocator_type | get_allocator () const |
Returns the allocator. | |
hash_map () | |
Constructs a default hash map. By default there's 100 buckets. | |
hash_map (size_type __n) | |
Constructs a hash map with a specific number of initial buckets. More... | |
hash_map (size_type __n, const hasher &__hf) | |
Constructs a hash map with a specific number of initial buckets and a hasher. More... | |
hash_map (size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type()) | |
Constructs a hash map with a specific number of initial buckets, a hasher, a comparison object and an allocator. More... | |
template<class _InputIterator > | |
hash_map (_InputIterator __f, _InputIterator __l) | |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators. More... | |
template<class _InputIterator > | |
hash_map (_InputIterator __f, _InputIterator __l, size_type __n) | |
Constructs a hash map with a specific number of initial buckets. More... | |
template<class _InputIterator > | |
hash_map (_InputIterator __f, _InputIterator __l, size_type __n, const hasher &__hf) | |
Constructs a hash map with a specific number of initial buckets and a hasher. More... | |
template<class _InputIterator > | |
hash_map (_InputIterator __f, _InputIterator __l, size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type()) | |
Constructs a hash map with a specific number of initial buckets, a hasher, an equality functor and an allocator. More... | |
hash_map (const value_type *__f, const value_type *__l) | |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators. More... | |
hash_map (const value_type *__f, const value_type *__l, size_type __n) | |
Constructs a hash map with a specific number of initial buckets. More... | |
hash_map (const value_type *__f, const value_type *__l, size_type __n, const hasher &__hf) | |
Constructs a hash map with a specific number of initial buckets and a hasher. More... | |
hash_map (const value_type *__f, const value_type *__l, size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type()) | |
Constructs a hash map with a specific number of initial. buckets, a hasher, a comparison object, and an allocator. More... | |
hash_map (const_iterator __f, const_iterator __l) | |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators. More... | |
hash_map (const_iterator __f, const_iterator __l, size_type __n) | |
Constructs a hash map with a specific number of initial buckets. More... | |
hash_map (const_iterator __f, const_iterator __l, size_type __n, const hasher &__hf) | |
Constructs a hash map with a specific number of initial buckets and a hasher. More... | |
hash_map (const_iterator __f, const_iterator __l, size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type()) | |
Constructs a hash map with a specific number of initial buckets, a hasher, an equality functor and an allocator. More... | |
size_type | size () const |
Returns the number of elements in the container. | |
size_type | max_size () const |
Returns the maximum number of elements that can be held in the container. | |
bool | empty () const |
Returns whether the container is empty or not. | |
void | swap (hash_map &__hs) |
Exchange the content of the container with another one. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
std::pair< iterator, bool > | insert (const value_type &__obj) |
Inserts a new element in the container. More... | |
template<class _InputIterator > | |
void | insert (_InputIterator __f, _InputIterator __l) |
Inserts new elements in the container. More... | |
void | insert (const value_type *__f, const value_type *__l) |
Inserts new elements in the container. More... | |
void | insert (const_iterator __f, const_iterator __l) |
Inserts new elements in the container. More... | |
std::pair< iterator, bool > | insert_noresize (const value_type &__obj) |
Inserts a new element in the container without increasing the number of buckets. More... | |
iterator | find (const key_type &__key) |
Search for a specific element in the container. More... | |
const_iterator | find (const key_type &__key) const |
_Tp & | operator[] (const key_type &__key) |
Access an element with a given key. If no element with the key is present, it inserts a default element with that key. More... | |
size_type | count (const key_type &__key) const |
Returns the number of elements with the specified key. More... | |
std::pair< iterator, iterator > | equal_range (const key_type &__key) |
Return a range that includes all the elements with a specific key. More... | |
std::pair< const_iterator, const_iterator > | equal_range (const key_type &__key) const |
Return a range that includes all the elements with a specific key. More... | |
size_type | erase (const key_type &__key) |
Removes all elements with the specified key from the container. More... | |
void | erase (iterator __it) |
Removes an element pointed by an iterator from the container. More... | |
void | erase (iterator __f, iterator __l) |
Removes some elements pointed by an iterator from the container. More... | |
void | clear () |
Removes all the elements from the container. | |
void | resize (size_type __hint) |
Increases the bucket count to at least __hint. | |
size_type | bucket_count () const |
Returns the number of buckets used by the container. | |
size_type | max_bucket_count () const |
Returns the maximum number of buckets that may be used by the container. | |
size_type | elems_in_bucket (size_type __n) const |
Returns the number of elements in a specific bucket. | |
size_type | memory_size (void) const |
Returns the size in the memory used by the container. | |
Public Types | |
typedef _Ht::key_type | key_type |
typedef _Tp | data_type |
typedef _Tp | mapped_type |
typedef _Ht::value_type | value_type |
typedef _Ht::hasher | hasher |
typedef _Ht::key_equal | key_equal |
typedef _Ht::size_type | size_type |
typedef _Ht::difference_type | difference_type |
typedef _Ht::pointer | pointer |
typedef _Ht::const_pointer | const_pointer |
typedef _Ht::reference | reference |
typedef _Ht::const_reference | const_reference |
typedef _Ht::iterator | iterator |
typedef _Ht::const_iterator | const_iterator |
typedef _Ht::allocator_type | allocator_type |
Friends | |
template<class _K1 , class _T1 , class _HF , class _EqK , class _Al > | |
bool | operator== (const hash_map< _K1, _T1, _HF, _EqK, _Al > &, const hash_map< _K1, _T1, _HF, _EqK, _Al > &) |
Container that stores key-value pairs by hashing the key to determine the position in the container where the elements will be stored.
_Key | The hash_map's key type. |
_Tp | The hash_map value type. |
_HashFcn | The hash function used by the hash_map. The default hash function is stapl::hash. |
_EqualKey | The key equality functor. Binary predicate used to compare key values of elements stored in the container for equality. The default equality functor is std::equal_to<_Key>. |
_Alloc | The hash_map's allocator used for internal memory management. The default allocator is std::allocator<_Tp>. |
|
explicit |
Constructs a hash map with a specific number of initial buckets.
__n | The number of buckets desired. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | size_type | __n, |
const hasher & | __hf | ||
) |
Constructs a hash map with a specific number of initial buckets and a hasher.
__n | The number of buckets desired. |
__hf | The hash functor. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | size_type | __n, |
const hasher & | __hf, | ||
const key_equal & | __eql, | ||
const allocator_type & | __a = allocator_type() |
||
) |
Constructs a hash map with a specific number of initial buckets, a hasher, a comparison object and an allocator.
__n | The number of buckets desired. |
__hf | The hash functor. |
__eql | The comparison object. |
__a | The allocator. By default a new one is constructed. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | _InputIterator | __f, |
_InputIterator | __l | ||
) |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l) |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | _InputIterator | __f, |
_InputIterator | __l, | ||
size_type | __n | ||
) |
Constructs a hash map with a specific number of initial buckets.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | _InputIterator | __f, |
_InputIterator | __l, | ||
size_type | __n, | ||
const hasher & | __hf | ||
) |
Constructs a hash map with a specific number of initial buckets and a hasher.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
__hf | The hash functor. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | _InputIterator | __f, |
_InputIterator | __l, | ||
size_type | __n, | ||
const hasher & | __hf, | ||
const key_equal & | __eql, | ||
const allocator_type & | __a = allocator_type() |
||
) |
Constructs a hash map with a specific number of initial buckets, a hasher, an equality functor and an allocator.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l) |
__n | The number of buckets desired. |
__hf | The hash functor. |
__eql | The equality functor. |
__a | The allocator. By default a new one is constructed. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const value_type * | __f, |
const value_type * | __l | ||
) |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators.
__f,__l | Pointers delimiting a range of elements to insert. The range of elements is [__f,__l) |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const value_type * | __f, |
const value_type * | __l, | ||
size_type | __n | ||
) |
Constructs a hash map with a specific number of initial buckets.
__n | The number of buckets desired. |
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const value_type * | __f, |
const value_type * | __l, | ||
size_type | __n, | ||
const hasher & | __hf | ||
) |
Constructs a hash map with a specific number of initial buckets and a hasher.
__f,__l | Pointers delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
__hf | The hash functor. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const value_type * | __f, |
const value_type * | __l, | ||
size_type | __n, | ||
const hasher & | __hf, | ||
const key_equal & | __eql, | ||
const allocator_type & | __a = allocator_type() |
||
) |
Constructs a hash map with a specific number of initial. buckets, a hasher, a comparison object, and an allocator.
__f,__l | Pointers delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
__hf | The hash functor. |
__eql | The comparison object. |
__a | The allocator. By default a new one is constructed. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const_iterator | __f, |
const_iterator | __l | ||
) |
Constructs a default hash map. By default there's 100 buckets. Inserts all the elements in a range of two input iterators.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l) |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const_iterator | __f, |
const_iterator | __l, | ||
size_type | __n | ||
) |
Constructs a hash map with a specific number of initial buckets.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const_iterator | __f, |
const_iterator | __l, | ||
size_type | __n, | ||
const hasher & | __hf | ||
) |
Constructs a hash map with a specific number of initial buckets and a hasher.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
__n | The number of buckets desired. |
__hf | The hash functor. |
stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::hash_map | ( | const_iterator | __f, |
const_iterator | __l, | ||
size_type | __n, | ||
const hasher & | __hf, | ||
const key_equal & | __eql, | ||
const allocator_type & | __a = allocator_type() |
||
) |
Constructs a hash map with a specific number of initial buckets, a hasher, an equality functor and an allocator.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l) |
__n | The number of buckets desired. |
__hf | The hash functor. |
__eql | The equality functor. |
__a | The allocator. By default a new one is constructed. |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::swap | ( | hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc > & | __hs | ) |
Exchange the content of the container with another one.
__hs | The container which swaps elements of the same type. |
std::pair<iterator,bool> stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::insert | ( | const value_type & | __obj | ) |
Inserts a new element in the container.
__obj | The element to be inserted. It is a pair<key,value>. |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::insert | ( | _InputIterator | __f, |
_InputIterator | __l | ||
) |
Inserts new elements in the container.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::insert | ( | const value_type * | __f, |
const value_type * | __l | ||
) |
Inserts new elements in the container.
__f,__l | Pointers delimiting a range of elements to insert. The range of elements is [__f,__l). |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::insert | ( | const_iterator | __f, |
const_iterator | __l | ||
) |
Inserts new elements in the container.
__f,__l | Input iterators delimiting a range of elements to insert. The range of elements is [__f,__l). |
std::pair<iterator,bool> stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::insert_noresize | ( | const value_type & | __obj | ) |
Inserts a new element in the container without increasing the number of buckets.
__obj | The element to be inserted. It is a pair<key,value>. |
iterator stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::find | ( | const key_type & | __key | ) |
Search for a specific element in the container.
__key | The key indexing the element. |
_Tp& stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::operator[] | ( | const key_type & | __key | ) |
Access an element with a given key. If no element with the key is present, it inserts a default element with that key.
__key | The key indexing the element. |
size_type stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::count | ( | const key_type & | __key | ) | const |
Returns the number of elements with the specified key.
__key | The key indexing the element. |
std::pair<iterator, iterator> stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::equal_range | ( | const key_type & | __key | ) |
Return a range that includes all the elements with a specific key.
__key | The key indexing the element. |
std::pair<const_iterator, const_iterator> stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::equal_range | ( | const key_type & | __key | ) | const |
Return a range that includes all the elements with a specific key.
__key | The key indexing the element. |
size_type stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::erase | ( | const key_type & | __key | ) |
Removes all elements with the specified key from the container.
__key | The key indexing the element. |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::erase | ( | iterator | __it | ) |
Removes an element pointed by an iterator from the container.
__it | The iterator over the element to delete. |
void stapl::hash_map< _Key, _Tp, _HashFcn, _EqualKey, _Alloc >::erase | ( | iterator | __f, |
iterator | __l | ||
) |
Removes some elements pointed by an iterator from the container.
__f,__l | Input iterators delimiting a range of elements to delete. The range of elements is [__f,__l). |