diff --git a/echion/strings.h b/echion/strings.h index 64005206..44231151 100644 --- a/echion/strings.h +++ b/echion/strings.h @@ -211,12 +211,12 @@ class StringTable : public std::unordered_map } #endif // UNWIND_NATIVE_DISABLE - [[nodiscard]] inline Result> lookup(Key key) + [[nodiscard]] inline Result> lookup(Key key) const { const std::lock_guard lock(table_lock); - auto it = this->find(key); - if (it == this->end()) + const auto it = this->find(key); + if (it == this->cend()) return ErrorKind::LookupError; return std::ref(it->second); @@ -230,7 +230,7 @@ class StringTable : public std::unordered_map }; private: - std::mutex table_lock; + mutable std::mutex table_lock; }; // We make this a reference to a heap-allocated object so that we can avoid