indigoX
simple_bimap.hpp
Go to the documentation of this file.
1 #include <EASTL/vector_map.h>
2 
3 #ifndef INDIGOX_UTILS_SIMPLE_BIMAP_HPP
4 #define INDIGOX_UTILS_SIMPLE_BIMAP_HPP
5 
6 namespace indigox::utils {
7  template <class L, class R> struct SimpleBiMap {
8  using LeftType = eastl::vector_map<L, R>;
9  using RightType = eastl::vector_map<R, L>;
12 
13  inline void insert(L l, R r) {
14  left.emplace(l, r);
15  right.emplace(r, l);
16  }
17  inline void erase(L l) {
18  right.erase(left.at(l));
19  left.erase(l);
20  }
21  inline void erase(R r) {
22  left.erase(right.at(r));
23  right.erase(r);
24  }
25  inline void clear() {
26  left.clear();
27  right.clear();
28  }
29  };
30 } // namespace indigox::utils
31 
32 #endif /* INDIGOX_UTILS_SIMPLE_BIMAP_HPP */
Definition: simple_bimap.hpp:7
Definition: common.hpp:24
eastl::vector_map< L, R > LeftType
Definition: simple_bimap.hpp:8
LeftType left
Definition: simple_bimap.hpp:10
void erase(L l)
Definition: simple_bimap.hpp:17
void insert(L l, R r)
Definition: simple_bimap.hpp:13
RightType right
Definition: simple_bimap.hpp:11
void erase(R r)
Definition: simple_bimap.hpp:21
void clear()
Definition: simple_bimap.hpp:25
eastl::vector_map< R, L > RightType
Definition: simple_bimap.hpp:9