|
EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
|
Maintains a bidirectional mapping between a key and value, allowing fast lookup on both objects. More...
#include <BidirectionalUnorderedMapping.hpp>
Public Types | |
| using | iterator = decltype(forward_map)::iterator |
| The bidirectional container non-constant iterator. | |
| using | const_iterator = decltype(forward_map)::const_iterator |
| The bidirectional container constant iterator. | |
Public Member Functions | |
| const_iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| bool | empty () const noexcept |
| std::size_t | size () const noexcept |
| void | clear () noexcept |
| Removes all entries from the mapping. | |
| template<typename KeyT, typename ValueT> | |
| std::pair< const_iterator, bool > | emplace (KeyT &&key, ValueT &&value) |
| Emplaces an entry to the mapping. | |
| bool | erase_by_key (const Key &key) |
| Removes an entry from the mapping by its key. | |
| bool | erase_by_value (const Value &value) |
| Removes an entry from the mapping by its value. | |
| const_iterator | find_by_key (const Key &key) const |
| Locates an entry in the mapping by its key. | |
| const_iterator | find_by_value (const Value &value) const |
| Locates an entry in the mapping by its value. | |
Private Attributes | |
| std::unordered_map< Key, Value > | forward_map |
| The "forward" map, mapping keys to values in the conventional way. | |
| std::unordered_map< Value, Key > | reverse_map |
| The "reverse" map, mapping values to keys. | |
Maintains a bidirectional mapping between a key and value, allowing fast lookup on both objects.
| Key | The first key type |
| Value | The second key type, colloquially the "value". |
The templated types should typically be small (such as a stable integral ID), since their values are duplicated internally across two STL unordered hashing containers.
To guarantee implementation invariants, the bidirectional mapping container does not expose mutable access to its members. Mutation of the iterators of the underlying storage containers can be done exclusively through the public interface.
Definition at line 33 of file BidirectionalUnorderedMapping.hpp.
| using echomap::BidirectionalUnorderedMapping< Key, Value >::const_iterator = decltype(forward_map)::const_iterator |
The bidirectional container constant iterator.
Definition at line 53 of file BidirectionalUnorderedMapping.hpp.
| using echomap::BidirectionalUnorderedMapping< Key, Value >::iterator = decltype(forward_map)::iterator |
The bidirectional container non-constant iterator.
Definition at line 52 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 55 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 60 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 70 of file BidirectionalUnorderedMapping.hpp.
|
inlinenoexcept |
Removes all entries from the mapping.
Definition at line 90 of file BidirectionalUnorderedMapping.hpp.
|
inline |
Emplaces an entry to the mapping.
| KeyT | Type of the forward key |
| ValueT | Type of the forward value |
| key | Key from the forward perspective |
| value | Value from the forward perspective |
Definition at line 118 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 75 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 65 of file BidirectionalUnorderedMapping.hpp.
|
inline |
Removes an entry from the mapping by its key.
| key | The key of the entry to remove. |
Definition at line 152 of file BidirectionalUnorderedMapping.hpp.
|
inline |
Removes an entry from the mapping by its value.
| value | The value of the entry to remove. |
Definition at line 175 of file BidirectionalUnorderedMapping.hpp.
|
inline |
Locates an entry in the mapping by its key.
| key | The key of the entry to locate. |
Definition at line 197 of file BidirectionalUnorderedMapping.hpp.
|
inline |
Locates an entry in the mapping by its value.
| value | The value of the entry to locate. |
Definition at line 210 of file BidirectionalUnorderedMapping.hpp.
|
inlinenodiscardnoexcept |
Definition at line 80 of file BidirectionalUnorderedMapping.hpp.
|
private |
The "forward" map, mapping keys to values in the conventional way.
Definition at line 41 of file BidirectionalUnorderedMapping.hpp.
|
private |
The "reverse" map, mapping values to keys.
Definition at line 49 of file BidirectionalUnorderedMapping.hpp.