1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

AK: Add missing GenericTraits<NonnullRefPtr>

This enables us to use keys of type NonnullRefPtr in HashMaps and
HashTables.

This commit also includes fixes in various places that used
HashMap<T, NonnullRefPtr<U>>::get() and expected to get an
Optional<NonnullRefPtr<U>> and now get an Optional<U*>.
This commit is contained in:
Itamar 2021-05-08 12:27:12 +03:00 committed by Andreas Kling
parent 1da0d402b7
commit 8a01167c7d
6 changed files with 20 additions and 7 deletions

View file

@ -46,14 +46,14 @@ public:
auto menu = m_menus.get(menu_id);
if (!menu.has_value())
return nullptr;
return const_cast<Menu*>(menu.value().ptr());
return menu.value();
}
const Menu* find_menu_by_id(int menu_id) const
{
auto menu = m_menus.get(menu_id);
if (!menu.has_value())
return nullptr;
return menu.value().ptr();
return menu.value();
}
template<typename Callback>