MCPcopy Create free account
hub / github.com/covscript/covscript / mapping

Class mapping

include/covscript/impl/symbols.hpp:158–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157 template <typename Key, typename T>
158 class mapping final {
159 std::map<Key, T> mDat;
160
161 public:
162 mapping(std::initializer_list<std::pair<const Key, T>> l) : mDat(l) {}
163
164 bool exist(const Key &k) const {
165 return mDat.count(k) > 0;
166 }
167
168 const T &match(const Key &k) const
169 {
170 if (!exist(k))
171 throw compile_error("Undefined Mapping.");
172 return mDat.at(k);
173 }
174 };
175
176 class token_base {
177 friend class compiler_type;

Callers

nothing calls this directly

Calls 2

compile_errorClass · 0.85
existFunction · 0.50

Tested by

no test coverage detected