|
ModErn Text Analysis
META Enumerates Textual Applications
|
This data structure indexes by keys as well as values, allowing constant amortized lookup time by key or value. More...
#include <invertible_map.h>
Classes | |
| class | invertible_map_exception |
| Basic exception for invertible_map interactions. More... | |
| class | Iterator |
| The invertible_map iterator is really just a wrapper for the forward (key -> value) unordered_map iterator. More... | |
Public Types | |
| typedef std::unordered_map< Key, Value >::const_iterator | InnerIterator |
| The "inner" iterator representation of the invertible_map. | |
| typedef Iterator | iterator |
| Easier typename to deal with if capital, also lets const_iterator share same name. | |
| typedef Iterator | const_iterator |
| Lets const_iterator be interchangeable with "iterator". | |
Public Member Functions | |
| invertible_map () | |
| Constructor. | |
| bool | empty () const |
| size_t | size () const |
| Key | get_key (const Value &value) const |
| Value | get_value (const Key &key) const |
| bool | contains_key (const Key &key) const |
| bool | contains_value (const Value &value) const |
| void | insert (const Key &key, const Value &value) |
| Inserts a (key, value) pair into the invertible map. More... | |
| void | insert (const std::pair< Key, Value > &pair) |
| Convenience function to add a (key, value) pair into the invertible map. More... | |
| void | clear () |
| Frees all keys from this object. | |
| const_iterator | begin () const |
| const_iterator | end () const |
Private Attributes | |
| std::unordered_map< Key, Value > | forward_ |
| The internal map representing Key -> Value pairs. | |
| std::unordered_map< Value, Key > | backward_ |
| The internal map representing Value -> Key pairs. | |
This data structure indexes by keys as well as values, allowing constant amortized lookup time by key or value.
All keys and values must be unique.
| bool meta::util::invertible_map< Key, Value >::empty | ( | ) | const |
| size_t meta::util::invertible_map< Key, Value >::size | ( | ) | const |
| Key meta::util::invertible_map< Key, Value >::get_key | ( | const Value & | value | ) | const |
| value | The value to search by |
| Value meta::util::invertible_map< Key, Value >::get_value | ( | const Key & | key | ) | const |
| key | The key to search by |
| bool meta::util::invertible_map< Key, Value >::contains_key | ( | const Key & | key | ) | const |
| key | The key to search for |
| bool meta::util::invertible_map< Key, Value >::contains_value | ( | const Value & | value | ) | const |
| value | The value to search for |
| void meta::util::invertible_map< Key, Value >::insert | ( | const Key & | key, |
| const Value & | value | ||
| ) |
Inserts a (key, value) pair into the invertible map.
| key | The key to insert |
| value | The value to insert |
| void meta::util::invertible_map< Key, Value >::insert | ( | const std::pair< Key, Value > & | pair | ) |
Convenience function to add a (key, value) pair into the invertible map.
| pair | The pair to add |
| invertible_map< Key, Value >::const_iterator meta::util::invertible_map< Key, Value >::begin | ( | ) | const |
| invertible_map< Key, Value >::const_iterator meta::util::invertible_map< Key, Value >::end | ( | ) | const |
1.8.9.1