From e1dc3b1759aee4ca551dc95233bd9aa57b58761f Mon Sep 17 00:00:00 2001 From: Thomas Kowalski Date: Fri, 5 Dec 2025 17:09:03 +0100 Subject: [PATCH] refactor: make StringTable::lookup const --- echion/strings.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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