8 #ifndef DICTIONARY_HPP_
9 #define DICTIONARY_HPP_
11 #include "Profiler/KapProfiler.hpp"
15 template <
typename TKey,
typename TValue>
18 std::map<TKey, TValue> map;
24 PROFILER_FUNC_START();
29 TValue& operator[](TKey key) {
30 PROFILER_FUNC_START();
35 bool tryGetValue(TKey key, TValue& value) {
36 PROFILER_FUNC_START();
37 auto it = map.find(key);
38 if (it == map.end()) {
47 bool containsKey(TKey key) {
48 PROFILER_FUNC_START();
49 auto it = map.find(key);
51 return it != map.end();
54 bool remove(TKey key) {
55 PROFILER_FUNC_START();
56 auto it = map.find(key);
57 if (it == map.end()) {
67 PROFILER_FUNC_START();
73 PROFILER_FUNC_START();
80 typename std::map<TKey, TValue>::iterator it;
83 Iterator(
typename std::map<TKey, TValue>::iterator _it) : it(_it) {
84 PROFILER_FUNC_START();
89 PROFILER_FUNC_START();
95 bool operator!=(
const Iterator& other)
const {
96 PROFILER_FUNC_START();
98 return it != other.it;
101 std::pair<TKey, TValue> operator*()
const {
102 PROFILER_FUNC_START();
109 PROFILER_FUNC_START();
115 PROFILER_FUNC_START();
117 return Iterator(map.end());
122 typename std::map<TKey, TValue>::const_iterator it;
125 ConstIterator(
typename std::map<TKey, TValue>::const_iterator _it) : it(_it) {
126 PROFILER_FUNC_START();
131 PROFILER_FUNC_START();
138 PROFILER_FUNC_START();
140 return it != other.it;
143 std::pair<TKey, TValue> operator*()
const {
144 PROFILER_FUNC_START();
151 PROFILER_FUNC_START();
156 ConstIterator end()
const {
157 PROFILER_FUNC_START();
159 return ConstIterator(map.end());