#include <bsa/detail/common.hpp>
template<class T, bool RECURSE>
hashmap class
Establishes a basic mapping between a key and its associated files.
Template parameters | |
---|---|
T | The mapped_type . |
RECURSE | Determines if indexing via operator[] is a recursive action. |
Public types
-
template<class U>class index_t
- A proxy value used to facilitate the usage/chaining of hashmap::
operator[] in an intuitive manner.
Assignment
Capacity
- auto empty() const -> bool noexcept
- Checks if the container is empty.
-
auto size() const -> std::
size_t noexcept - Returns the number of elements in the container.
Constructors
Destructor
- ~hashmap() defaulted noexcept
Iterators
- auto begin() -> iterator noexcept
- Obtains an interator to the beginning of the container.
-
auto begin() const -> const_
iterator noexcept - Obtains an interator to the beginning of the container.
-
auto cbegin() const -> const_
iterator noexcept - Obtains an interator to the beginning of the container.
-
auto cend() const -> const_
iterator noexcept - Obtains an iterator to the end of the container.
- auto end() -> iterator noexcept
- Obtains an iterator to the end of the container.
-
auto end() const -> const_
iterator noexcept - Obtains an iterator to the end of the container.
Lookup
-
auto find(const key_
type& a_key) -> iterator noexcept - Finds a
value_type
with the given key within the container. -
auto find(const key_
type& a_key) const -> const_ iterator noexcept - Finds a
value_type
with the given key within the container. -
auto operator[](const key_
type& a_key) -> index noexcept - Obtains a proxy to the underlying
mapped_type
. The validity of the proxy depends on the presence of the key within the container. -
auto operator[](const key_
type& a_key) const -> const_ index noexcept - Obtains a proxy to the underlying
mapped_type
. The validity of the proxy depends on the presence of the key within the container.
Member types
-
using const_index = index_
t<const mapped_ type> - using const_iterator = typename container_type::const_iterator
-
using index = index_
t<mapped_ type> - using iterator = typename container_type::iterator
- using key_compare = typename container_type::key_compare
- using key_type = typename T::key
- using mapped_type = T
-
using value_type = std::
pair<const key_ type, mapped_ type>
Modifiers
Function documentation
template<class T, bool RECURSE>
std:: pair<iterator, bool> bsa:: components:: hashmap<T, RECURSE>:: insert(key_ type a_key,
mapped_ type a_value) noexcept
Inserts a_value
into the container with the given a_key
.
Parameters | |
---|---|
a_key | The key of the value_type . |
a_value | The value of the value_type . |
Returns | Returns an iterator to the position at which the given value_type was inserted, and a bool to indicate if the insertion was successful. |