mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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:
parent
ef7f343e95
commit
2f67f2ba3d
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/2f67f2ba3d Pull-request: https://github.com/SerenityOS/serenity/pull/17276
1 changed files with 2 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue