Return the black‐node depth of a bounded valid red‐black tree.

Synopsis

Declared in <bslalg_rbtreeutil.h>

template<class NODE_COMPARATOR>
static
int
validateRbTree(
    RbTreeNode const** errorNode,
    char const** errorDescription,
    RbTreeNode const* rootNode,
    RbTreeNode const* minNodeValue,
    RbTreeNode const* maxNodeValue,
    NODE_COMPARATOR const& comparator);

Description

Return the (common) number of black nodes on each path from the specified rootNode to a leaf in the tree, 0 if rootNode is 0, and a negative number if rootNode does not refer to a valid red‐black binary search tree (ordered according to the specified comparator) that contains no nodes whose value is less than the specified minNodeValue (if not 0) or greater‐than the specified maxNodeValue (if not 0). If rootNode does not refer to a valid red‐black tree containing nodes whose values are between the specified minNodeValue and maxNodeValue (inclusively) then load errorNode and errorDescription with the address of a node violating a red‐black tree constraint and a description of that violation, respectively. The behavior is undefined unless rootNode is 0, or refers to a valid binary tree.

Return Value

black‐node depth, 0 if rootNode is 0, or a negative number if invalid

Parameters

Name

Description

errorNode

set to a node that violates a red‐black constraint

errorDescription

set to a description of the violation

rootNode

root of the tree to validate, or 0

minNodeValue

lower bound for allowed node values, or 0

maxNodeValue

upper bound for allowed node values, or 0

comparator

functor used to order nodes in the tree

Created with MrDocs