[#BloombergLP-bslalg-RbTreeUtil_Validator-isWellFormedAnchor]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RbTreeUtil_Validator.adoc[RbTreeUtil&lowbar;Validator]::isWellFormedAnchor
:relfileprefix: ../../../
:mrdocs:

Return `true` if the specified `tree` is well&hyphen;formed, without confirming that it refers to a valid&hyphen;red&hyphen;black tree, and `false` otherwise&period; This method will return `true` if _all_ of the following are true&colon;

== Synopsis

Declared in `&lt;bslalg&lowbar;rbtreeutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
bool
isWellFormedAnchor(xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor] const& tree);
----

== Description

1&period; `tree&period;firstNode()` must refer to `tree&period;sentinel()` if `tree&period;rootNode()` is 0, and leftmost(tree&period;rootNode())&apos; otherwise&period; 2&period; `tree&period;nodeCount()` must be the count of nodes in `tree` (not including the sentinel node)&period; 3&period; `tree&period;sentinel()&hyphen;&gt;leftchild()` is `tree&period;rootNode()`, and (if `tree&period;rootNode()` is not 0), `tree&period;rootNode()&hyphen;&gt;parent()` is &apos;tree&period;sentinel()&period; 4&period; `tree&period;rootNode()` is 0 or `tree&period;rootNode()&period;isBlack()` is `true`

The behavior is undefined unless `tree&period;rootNode()` is 0, or refers to a valid binary tree&period; Note that this function provides a non&hyphen;templatized implementation for several criteria of a well&hyphen;formed tree (but not the complete set verified by `RbTreeUtil&colon;&colon;isWellFormed`)&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
