mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
AK: Add find methods to RedBlackTree returning mutable iterators
Mutable iterators are needed in order for IncrementallyPopulatedStream to expand chunks after they have been added.
This commit is contained in:
committed by
Gregory Bertilson
parent
0734a37e24
commit
8405af3f18
Notes:
github-actions[bot]
2026-02-06 10:56:28 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/8405af3f187 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7473
@@ -505,6 +505,22 @@ public:
|
||||
Iterator end() { return {}; }
|
||||
Iterator begin_from(K key) { return Iterator(static_cast<Node*>(BaseTree::find(this->m_root, key))); }
|
||||
|
||||
Iterator find_largest_not_above_iterator(K key)
|
||||
{
|
||||
auto node = static_cast<Node*>(BaseTree::find_largest_not_above(this->m_root, key));
|
||||
if (!node)
|
||||
return end();
|
||||
return Iterator(node, static_cast<Node*>(BaseTree::predecessor(node)));
|
||||
}
|
||||
|
||||
Iterator find_smallest_not_below_iterator(K key)
|
||||
{
|
||||
auto node = static_cast<Node*>(BaseTree::find_smallest_not_below(this->m_root, key));
|
||||
if (!node)
|
||||
return end();
|
||||
return Iterator(node, static_cast<Node*>(BaseTree::predecessor(node)));
|
||||
}
|
||||
|
||||
using ConstIterator = RedBlackTreeIterator<RedBlackTree const, V const>;
|
||||
friend ConstIterator;
|
||||
ConstIterator begin() const { return ConstIterator(static_cast<Node*>(this->m_minimum)); }
|
||||
|
||||
Reference in New Issue
Block a user