[#BloombergLP-bslalg-RbTreeUtil-deleteTree]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RbTreeUtil.adoc[RbTreeUtil]::deleteTree
:relfileprefix: ../../../
:mrdocs:

Destroy every node in `tree` and reset it to empty&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FACTORY&gt;
static
void
deleteTree(
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* tree,
    FACTORY* nodeFactory);
----

== Description

Call `nodeFactory&hyphen;&gt;deleteNode` on each node in `tree` and reset `tree` to an empty state&period; `FACTORY` shall be a class providing a method that can be called as if it has the following signature&colon; &grave; void deleteNode(RbTreeNode &ast;)&semi; &grave; The behavior is undefined unless `tree` is a valid binary tree, and `nodeFactory&hyphen;&gt;deleteNode` does not throw&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *tree*
| tree whose nodes are destroyed
| *nodeFactory*
| factory used to destroy each node
|===


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