mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add OrderedHashMap::take_first()
This is just a convenience shortcut for *take(begin()->key).
This commit is contained in:
parent
0042bbb68d
commit
08ec58f347
Notes:
github-actions[bot]
2024-10-24 18:56:05 +00:00
Author: https://github.com/alimpfard Commit: https://github.com/LadybirdBrowser/ladybird/commit/08ec58f3479 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1828
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue