|
Jlm
|
#include <BijectiveMap.hpp>
Classes | |
| class | ConstIterator |
Public Types | |
| using | ItemType = std::pair< const K, V > |
Public Member Functions | |
| ~BijectiveMap () noexcept=default | |
| BijectiveMap ()=default | |
| BijectiveMap (const BijectiveMap &other)=default | |
| BijectiveMap (BijectiveMap &&other) noexcept=default | |
| template<class InputIt > | |
| BijectiveMap (InputIt first, InputIt last) | |
| BijectiveMap (std::initializer_list< ItemType > init) | |
| BijectiveMap & | operator= (const BijectiveMap &other)=default |
| BijectiveMap & | operator= (BijectiveMap &&other)=default |
| void | Clear () noexcept |
| std::size_t | Size () const noexcept |
| bool | Insert (const K &key, const V &value) |
| template<typename IteratorType > | |
| size_t | InsertPairs (IteratorType begin, IteratorType end) |
| void | InsertOrThrow (const K &key, const V &value) |
| bool | HasKey (const K &key) const noexcept |
| bool | HasValue (const V &value) const noexcept |
| const V & | LookupKey (const K &key) const |
| const K & | LookupValue (const V &value) const |
| ConstIterator | begin () const noexcept |
| ConstIterator | end () const noexcept |
| ConstIterator | Erase (ConstIterator it) |
| bool | RemoveKey (const K &key) |
| bool | RemoveValue (const V &value) |
| template<typename F > | |
| size_t | RemoveWhere (const F &match) |
| template<typename F > | |
| size_t | RemoveKeysWhere (const F &match) |
| template<typename F > | |
| size_t | RemoveValuesWhere (const F &match) |
| bool | operator== (const BijectiveMap &other) const noexcept |
| bool | operator!= (const BijectiveMap &other) const noexcept |
Private Types | |
| using | ForwardMapType = std::unordered_map< K, V > |
| using | ReverseMapType = std::unordered_map< V, K > |
Private Attributes | |
| ForwardMapType | ForwardMap_ |
| ReverseMapType | ReverseMap_ |
Represents a bijective mapping between keys and values, with on average constant time lookups by either key or value. Keys and values must be unique among themselves.
| K | the type of keys |
| V | the type of values |
Definition at line 22 of file BijectiveMap.hpp.
|
private |
Definition at line 24 of file BijectiveMap.hpp.
| using jlm::util::BijectiveMap< K, V >::ItemType = std::pair<const K, V> |
Definition at line 28 of file BijectiveMap.hpp.
|
private |
Definition at line 25 of file BijectiveMap.hpp.
|
defaultnoexcept |
|
default |
Constructs an empty BijectiveMap
|
default |
|
defaultnoexcept |
|
inlineexplicit |
Constructs a BijectiveMap from a range of std::pair<K, V>.
| jlm::util::error | if any key or value is not unique |
Definition at line 106 of file BijectiveMap.hpp.
|
inline |
Constructs a BijectiveMap from an initializer list of std::pair<K, V>
| init | the initializer list |
| jlm::util::error | if any key or value is not unique |
Definition at line 119 of file BijectiveMap.hpp.
|
inlinenoexcept |
Provides an iterator pointing to the first key/value mappings in the BijectiveMap, that can be used to iterate over all pairs, with no ordering guarantees.
Definition at line 262 of file BijectiveMap.hpp.
|
inlinenoexcept |
Removes all key/value mappings from the BijectiveMap.
Definition at line 133 of file BijectiveMap.hpp.
|
inlinenoexcept |
Provides an iterator pointing to the element following the last key/value mapping. It is a placeholder, and must not be accessed.
Definition at line 273 of file BijectiveMap.hpp.
|
inline |
Given an iterator pointing to a key/value pair in the BijectiveMap, removes that pair. The iterator must be valid, and not point to end(). Only the removed iterator is affected by this operation, all other iterators stay valid.
| it | an iterator pointing to the element to be removed |
Definition at line 286 of file BijectiveMap.hpp.
|
inlinenoexcept |
Checks for the existance of the given key in the BijectiveMap
| key | the key to look for |
Definition at line 212 of file BijectiveMap.hpp.
|
inlinenoexcept |
Checks for the existance of the given value in the BijectiveMap
| value | the value to look for |
Definition at line 223 of file BijectiveMap.hpp.
|
inline |
Inserts a new key/value pair into the BijectiveMap, if neither the key nor the value are present in the map already.
| key | the key to be inserted, with the associated value |
| value | the value to be inserted, associated with the key |
Definition at line 157 of file BijectiveMap.hpp.
|
inline |
Inserts a new key/value pair into the BijectiveMap. Fails if either the key or value are already present in the map.
| key | the key to be inserted, with the associated value |
| value | the value to be inserted, associated with the key |
| jlm::util::error | if the key or value already exists in the map |
Definition at line 200 of file BijectiveMap.hpp.
|
inline |
Tries to insert all key/value mappings provided by an iterator range
| IteratorType | the iterator type, a forward iterator with std::pair<K, V> value type. |
| begin | an iterator pointing to the first key/value pair to be inserted |
| end | an iterator pointing just past the last key/value pair to be inserted |
Definition at line 176 of file BijectiveMap.hpp.
|
inline |
| key | the key to lookup in the BijectiveMap |
key | jlm::util::error | if the key does not exist in the BijectiveMap |
Definition at line 234 of file BijectiveMap.hpp.
|
inline |
| value | the value to lookup in the BijectiveMap |
value | jlm::util::error | if the value does not exist in the BijectiveMap |
Definition at line 248 of file BijectiveMap.hpp.
|
inlinenoexcept |
Checks for inequality between two BijectiveMaps.
Definition at line 407 of file BijectiveMap.hpp.
|
default |
|
default |
|
inlinenoexcept |
Compares the key/value mapping in two BijectiveMaps.
| other | the BijectiveMap to comapre against |
Definition at line 396 of file BijectiveMap.hpp.
|
inline |
Removes a key/value pair from the BijectiveMap, if the given key exists
| key | the key to be removed |
Definition at line 300 of file BijectiveMap.hpp.
|
inline |
Removes all key/value pairs where the key satisfies the predicate match.
| F | a functor with the signature (const K &) -> bool |
| match | an instance of F, to be invoked on each key |
Definition at line 364 of file BijectiveMap.hpp.
|
inline |
Removes a key/value pair from the BijectiveMap, if the given value exists
| value | the value to be removed |
Definition at line 316 of file BijectiveMap.hpp.
|
inline |
Removes all key/value pairs where the value satisfies the predicate match.
| F | a functor with the signature (const V &) -> bool |
| match | an instance of F, to be invoked on each value |
Definition at line 381 of file BijectiveMap.hpp.
|
inline |
Removes all key/value pairs in the BijectiveMap that satisfy the predicate match.
| F | a functor with the signature (const K &, const V &) -> bool |
| match | an instance of F, to be invoked on each pair |
Definition at line 337 of file BijectiveMap.hpp.
|
inlinenoexcept |
Gets the number of key/value mappings in the BijectiveMap.
Definition at line 143 of file BijectiveMap.hpp.
|
private |
Definition at line 413 of file BijectiveMap.hpp.
|
private |
Definition at line 414 of file BijectiveMap.hpp.