mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add RedBlackTree::find_largest_not_above_iterator
It's a version of find_largest_not_above that returns an iterator.
This commit is contained in:
parent
98a774a68d
commit
d26f4f9e8c
Notes:
sideshowbarker
2024-07-18 12:01:36 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/d26f4f9e8c3 Pull-request: https://github.com/SerenityOS/serenity/pull/8149 Reviewed-by: https://github.com/gunnarbeutner
1 changed files with 6 additions and 0 deletions
|
@ -464,6 +464,12 @@ public:
|
|||
ConstIterator end() const { return {}; }
|
||||
ConstIterator begin_from(K key) const { return ConstIterator(static_cast<Node*>(BaseTree::find(this->m_root, key))); }
|
||||
|
||||
ConstIterator find_largest_not_above_iterator(K key) const
|
||||
{
|
||||
auto node = static_cast<Node*>(BaseTree::find_largest_not_above(this->m_root, key));
|
||||
return ConstIterator(node, static_cast<Node*>(BaseTree::predecessor(node)));
|
||||
}
|
||||
|
||||
V unsafe_remove(K key)
|
||||
{
|
||||
auto* node = BaseTree::find(this->m_root, key);
|
||||
|
|
Loading…
Reference in a new issue