1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:37:44 +00:00

AK: Expose RedBlackTree::find_smallest_not_below()

This commit is contained in:
Tim Schumacher 2022-04-20 18:42:30 +02:00 committed by Andreas Kling
parent 02c18bf6de
commit 908d5a2853
2 changed files with 17 additions and 0 deletions

View file

@ -467,6 +467,14 @@ public:
return &node->value;
}
[[nodiscard]] V* find_smallest_not_below(K key)
{
auto* node = static_cast<Node*>(BaseTree::find_smallest_not_below(this->m_root, key));
if (!node)
return nullptr;
return &node->value;
}
ErrorOr<void> try_insert(K key, V const& value)
{
return try_insert(key, V(value));