mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Return Optional<ConstPeekType> for HashMap::get() const
While the previous implementation always copied the object, returning a non-const reference to a const object is not valid.
This commit is contained in:
parent
221ecf17d3
commit
1a74895680
Notes:
sideshowbarker
2024-07-17 14:28:14 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1a74895680 Pull-request: https://github.com/SerenityOS/serenity/pull/13470 Reviewed-by: https://github.com/BenWiederhake ✅ Reviewed-by: https://github.com/creator1creeper1 Reviewed-by: https://github.com/sin-ack ✅
1 changed files with 1 additions and 1 deletions
|
@ -127,7 +127,7 @@ public:
|
|||
void ensure_capacity(size_t capacity) { m_table.ensure_capacity(capacity); }
|
||||
ErrorOr<void> try_ensure_capacity(size_t capacity) { return m_table.try_ensure_capacity(capacity); }
|
||||
|
||||
Optional<typename Traits<V>::PeekType> get(const K& key) const requires(!IsPointer<typename Traits<V>::PeekType>)
|
||||
Optional<typename Traits<V>::ConstPeekType> get(const K& key) const requires(!IsPointer<typename Traits<V>::PeekType>)
|
||||
{
|
||||
auto it = find(key);
|
||||
if (it == end())
|
||||
|
|
Loading…
Reference in a new issue