AK: Return a constant reference from HashMap's constant get() override

We cannot return a mutable reference from a constant function.
This commit is contained in:
Timothy Flynn 2023-02-02 11:02:39 -05:00 committed by Linus Groh
parent ef7f343e95
commit 2f67f2ba3d
Notes: sideshowbarker 2024-07-17 22:41:14 +09:00

View file

@ -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);