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

Move nodes from `original` into empty `result`&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
moveTree(
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* result,
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* original,
    FACTORY* nodeFactory,
    FACTORY* originalNodeFactory);
----

== Description

Load into the specified `result`, using the specified `nodeFactory` to create and delete nodes, a collection of newly created nodes with the same (red&hyphen;black) tree structure as that of the specified `original` tree, which uses the specified `originalNodeFactory` to create and delete nodes, where the `value` attribute of each node in `result` is constructed from explicitly moving the `value` attribute of the corresponding node in `original`&period; `original` is left in a valid but unspecified state&period; If an exception occurs, both `result` and `original` are left in a valid but unspecified state&period; The behavior is undefined unless `result` is an empty tree, `original` is well&hyphen;formed (see `isWellFormed`), and `nodeFactory&hyphen;&gt;deleteNode` and `originalNodeFactory&hyphen;&gt;deleteNode` do not throw&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| empty tree that receives the moved nodes
| *original*
| well&hyphen;formed tree whose nodes are moved from
| *nodeFactory*
| factory used to create nodes in `result`
| *originalNodeFactory*
| factory used to destroy nodes in `original`
|===


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