diff --git a/libs/util/include/psemek/util/hash_table.hpp b/libs/util/include/psemek/util/hash_table.hpp index 5fef85b0..83fac31c 100644 --- a/libs/util/include/psemek/util/hash_table.hpp +++ b/libs/util/include/psemek/util/hash_table.hpp @@ -475,6 +475,14 @@ namespace psemek::util return impl_.insert(std::move(value)); } + template + Value & operator[] (Key1 const & key) + { + if (auto it = find(key); it != end()) + return it->second; + return insert({Key(key), Value{}}).first->second; + } + template iterator find(Key1 const & key) const {