AK: Add OrderedHashMap::take_first()

This is just a convenience shortcut for *take(begin()->key).
This commit is contained in:
Ali Mohammad Pur 2024-10-16 15:42:23 +02:00 committed by Andreas Kling
parent 0042bbb68d
commit 08ec58f347
Notes: github-actions[bot] 2024-10-24 18:56:05 +00:00

View file

@ -243,6 +243,12 @@ public:
return {}; return {};
} }
V take_first()
requires(IsOrdered)
{
return take(begin()->key).release_value();
}
V& ensure(K const& key) V& ensure(K const& key)
{ {
auto it = find(key); auto it = find(key);