AVLTree: Add convenience LeftMost/RightMost with no arguments.

They return the left and right most nodes of the entire tree, i.e.
starting from the root node.

Change-Id: I651a9db6d12308aef4c2ed71484958428e58c9bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2838
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Michael Lotz
2020-05-30 01:47:40 +00:00
committed by waddlesplash
parent 928d780bc9
commit 621f53700f
2 changed files with 37 additions and 1 deletions
+17 -1
View File
@@ -46,7 +46,9 @@ public:
inline AVLTreeNode* Root() const { return fRoot; }
inline AVLTreeNode* LeftMost() const;
AVLTreeNode* LeftMost(AVLTreeNode* node) const;
inline AVLTreeNode* RightMost() const;
AVLTreeNode* RightMost(AVLTreeNode* node) const;
AVLTreeNode* Previous(AVLTreeNode* node) const;
@@ -190,11 +192,25 @@ protected:
};
inline AVLTreeNode*
AVLTreeBase::LeftMost() const
{
return LeftMost(fRoot);
}
inline AVLTreeNode*
AVLTreeBase::RightMost() const
{
return RightMost(fRoot);
}
// GetIterator
inline AVLTreeIterator
AVLTreeBase::GetIterator() const
{
return AVLTreeIterator(this, NULL, LeftMost(fRoot));
return AVLTreeIterator(this, NULL, LeftMost());
}