summaryrefslogtreecommitdiff
path: root/AK/HashMap.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-02-02 11:02:39 -0500
committerLinus Groh <mail@linusgroh.de>2023-02-02 19:14:00 +0000
commit2f67f2ba3d2ba151caa5426cd79236f7b7a0fb3d (patch)
tree51de88080b63752caeb18aaa27f3e95c52749ab9 /AK/HashMap.h
parentef7f343e9518aecb47f6a4405b6bda18962f1531 (diff)
downloadserenity-2f67f2ba3d2ba151caa5426cd79236f7b7a0fb3d.zip
AK: Return a constant reference from HashMap's constant get() override
We cannot return a mutable reference from a constant function.
Diffstat (limited to 'AK/HashMap.h')
-rw-r--r--AK/HashMap.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/AK/HashMap.h b/AK/HashMap.h
index 979740ac49..ec8d946472 100644
--- a/AK/HashMap.h
+++ b/AK/HashMap.h
@@ -154,8 +154,7 @@ public:
}
template<Concepts::HashCompatible<K> Key>
- requires(IsSame<KeyTraits, Traits<K>>) Optional<typename ValueTraits::PeekType> get(Key const& key)
- const
+ requires(IsSame<KeyTraits, Traits<K>>) Optional<typename ValueTraits::ConstPeekType> get(Key const& key) const
requires(!IsPointer<typename ValueTraits::PeekType>)
{
auto it = find(key);
@@ -165,8 +164,7 @@ public:
}
template<Concepts::HashCompatible<K> Key>
- requires(IsSame<KeyTraits, Traits<K>>) Optional<typename ValueTraits::ConstPeekType> get(Key const& key)
- const
+ requires(IsSame<KeyTraits, Traits<K>>) Optional<typename ValueTraits::ConstPeekType> get(Key const& key) const
requires(IsPointer<typename ValueTraits::PeekType>)
{
auto it = find(key);