[#BloombergLP-bslalg-RbTreeUtil-copyTree] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RbTreeUtil.adoc[RbTreeUtil]::copyTree :relfileprefix: ../../../ :mrdocs: Load, into the specified `result`, a collection of newly created nodes having the same red‐black tree structure as that of the specified `original` tree, where each node in the returned tree is created by invoking `nodeFactory‐>createNode` on the corresponding `original` node; if an exception occurs, use `nodeFactory‐>deleteNode` to destroy any newly created nodes, and propagate the exception to the caller (i.e., this operation provides the _strong_ exception guarantee). `FACTORY` shall be a class providing two methods that can be called as if they had the following signatures: ` RbTreeNode *createNode(const RbTreeNode&); void deleteNode(RbTreeNode *); ` The behavior is undefined unless `result` is an empty tree, `original` is a well‐formed (see `isWellFormed`), and `nodeFactory‐>deleteNode` does not throw. == Synopsis Declared in `<bslalg_rbtreeutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class FACTORY> static void copyTree( xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* result, xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor] const& original, FACTORY* nodeFactory); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#