Return whether tree is well‐formed, ignoring red‐black validity.
Synopsis
Declared in <bslalg_rbtreeutil.h>
static
bool
isWellFormedAnchor(RbTreeAnchor const& tree);
Description
Return true if the specified tree is well‐formed, without confirming that it refers to a valid‐red‐black tree, and false otherwise. This method will return true if all of the following are true:
1. tree.firstNode() must refer to tree.sentinel() if tree.rootNode() is 0, and leftmost(tree.rootNode())' otherwise. 2. tree.nodeCount() must be the count of nodes in tree (not including the sentinel node). 3. tree.sentinel()‐>leftchild() is tree.rootNode(), and (if tree.rootNode() is not 0), tree.rootNode()‐>parent() is 'tree.sentinel(). 4. tree.rootNode() is 0 or tree.rootNode().isBlack() is true
The behavior is undefined unless tree.rootNode() is 0, or refers to a valid binary tree. Note that this function provides a non‐templatized implementation for several criteria of a well‐formed tree (but not the complete set verified by RbTreeUtil::isWellFormed).
Return Value
true if tree is well‐formed (ignoring red‐black validity)
Parameters
Name |
Description |
tree |
tree whose anchor invariants are tested |
Created with MrDocs