template<typename L, typename R, typename LHash = std::hash<L>, typename RHash = std::hash<R>>
cubos::core::memory::UnorderedBimap class final

A bidirectional hash table.

Template parameters
L Left type.
R Right type.
LHash Hash functor type for L.
RHash Hash functor type for R.

Public functions

void insert(L left, R right)
Adds a new entry to the map.
auto eraseLeft(const L& left) -> bool
Removes the entry associated to the given left value.
auto eraseRight(const R& right) -> bool
Removes the entry associated to the given right value.
auto contains(const L& left, const R& right) const -> bool
Checks if the map has the given entry.
auto containsLeft(const L& left) const -> bool
Checks if the map contains the given left value.
auto containsRight(const R& right) const -> bool
Checks if the map contains the given right value.
auto atLeft(const L& left) const -> const R&
Gets the right value associated to the given left value.
auto atRight(const R& right) const -> const L&
Gets the left value associated to the given right value.
void clear()
Clears the map.
auto size() const -> std::size_t
Gets the number of entries in the map.
auto empty() const -> bool
Checks if the map is empty.
auto begin() const -> Iterator
Gets an iterator to the beginning of the map.
auto end() const -> Iterator
Gets an iterator to the end of the map.

Function documentation

template<typename L, typename R, typename LHash, typename RHash>
void cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::insert(L left, R right)

Adds a new entry to the map.

Parameters
left Left value.
right Right value.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::eraseLeft(const L& left)

Removes the entry associated to the given left value.

Parameters
left Left value.
Returns Whether the entry was removed.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::eraseRight(const R& right)

Removes the entry associated to the given right value.

Parameters
right Right value.
Returns Whether the entry was removed.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::contains(const L& left, const R& right) const

Checks if the map has the given entry.

Parameters
left Left value.
right Right value.
Returns Whether the map has the entry.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::containsLeft(const L& left) const

Checks if the map contains the given left value.

Parameters
left Left value.
Returns Whether the map contains the value.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::containsRight(const R& right) const

Checks if the map contains the given right value.

Parameters
right Right value.
Returns Whether the map contains the value.

template<typename L, typename R, typename LHash, typename RHash>
const R& cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::atLeft(const L& left) const

Gets the right value associated to the given left value.

Parameters
left Left value.
Returns Right value.

template<typename L, typename R, typename LHash, typename RHash>
const L& cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::atRight(const R& right) const

Gets the left value associated to the given right value.

Parameters
right Right value.
Returns Left value.

template<typename L, typename R, typename LHash, typename RHash>
std::size_t cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::size() const

Gets the number of entries in the map.

Returns Entry count.

template<typename L, typename R, typename LHash, typename RHash>
bool cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::empty() const

Checks if the map is empty.

Returns Whether the map is empty.

template<typename L, typename R, typename LHash, typename RHash>
Iterator cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::begin() const

Gets an iterator to the beginning of the map.

Returns Iterator.

template<typename L, typename R, typename LHash, typename RHash>
Iterator cubos::core::memory::UnorderedBimap<L, R, LHash, RHash>::end() const

Gets an iterator to the end of the map.

Returns Iterator.