Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ class StringTable : public std::unordered_map<uintptr_t, std::string>
return k;
};

[[nodiscard]] inline Result<std::reference_wrapper<std::string>> lookup(Key key)
[[nodiscard]] inline Result<std::reference_wrapper<const std::string>> lookup(Key key) const
{
const std::lock_guard<std::mutex> 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);
Expand All @@ -159,7 +159,7 @@ class StringTable : public std::unordered_map<uintptr_t, std::string>
};

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
Expand Down
Loading