30 template <
typename KEY,
typename VALUE>
39 using iterator =
typename std::map<KEY, VALUE>::iterator;
41 typename std::map<VALUE, KEY>::const_iterator;
71 void insert(
const KEY& k,
const VALUE& v)
82 bool direct(
const KEY& k, VALUE& out_v)
const 85 if (i ==
m_k2v.end())
return false;
92 inline bool hasKey(
const KEY& k)
const 110 auto i =
m_k2v.find(k);
120 bool inverse(
const VALUE& v, KEY& out_k)
const 123 if (i ==
m_v2k.end())
return false;
135 auto i =
m_v2k.find(v);
144 return m_v2k.find(v);
const_iterator end() const
iterator_inverse inverse_begin()
const_iterator_inverse find_value(const VALUE &v) const
#define THROW_EXCEPTION(msg)
std::map< VALUE, KEY > m_v2k
const_iterator_inverse inverse_end() const
const_iterator find_key(const KEY &k) const
bool hasKey(const KEY &k) const
Return true if the given key 'k' is in the bi-map.
void insert(const KEY &k, const VALUE &v)
Insert a new pair KEY<->VALUE in the bi-map.
const_iterator_inverse inverse_begin() const
void clear()
Clear the contents of the bi-map.
bimap()=default
Default constructor - does nothing.
iterator_inverse find_value(const VALUE &v)
const std::map< VALUE, KEY > & getInverseMap() const
Return a read-only reference to the internal map KEY->VALUES.
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
iterator_inverse inverse_end()
typename std::map< mrpt::maps::CLandmark::TLandmarkID, unsigned int >::const_iterator const_iterator
VALUE direct(const KEY &k) const
Get the value associated the given key, KEY->VALUE, raising an exception if not present.
typename std::map< unsigned int, mrpt::maps::CLandmark::TLandmarkID >::const_iterator const_iterator_inverse
typename std::map< mrpt::maps::CLandmark::TLandmarkID, unsigned int >::iterator iterator
bool inverse(const VALUE &v, KEY &out_k) const
Get the key associated the given value, VALUE->KEY, returning false if not present.
typename std::map< unsigned int, mrpt::maps::CLandmark::TLandmarkID >::iterator iterator_inverse
const std::map< KEY, VALUE > & getDirectMap() const
Return a read-only reference to the internal map KEY->VALUES.
KEY inverse(const VALUE &v) const
Get the key associated the given value, VALUE->KEY, raising an exception if not present.
bool hasValue(const VALUE &v) const
Return true if the given value 'v' is in the bi-map.
iterator find_key(const KEY &k)
bool direct(const KEY &k, VALUE &out_v) const
Get the value associated the given key, KEY->VALUE, returning false if not present.
const_iterator begin() const
std::map< KEY, VALUE > m_k2v