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

Return the insert parent for `value`, using an optional `hint`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class NODE&lowbar;VALUE&lowbar;COMPARATOR,
    class VALUE&gt;
static
xref:BloombergLP/bslalg/RbTreeNode.adoc[RbTreeNode]*
findInsertLocation(
    bool* insertAsLeftChildFlag,
    xref:BloombergLP/bslalg/RbTreeAnchor.adoc[RbTreeAnchor]* tree,
    NODE&lowbar;VALUE&lowbar;COMPARATOR& comparator,
    VALUE const& value,
    xref:BloombergLP/bslalg/RbTreeNode.adoc[RbTreeNode]* hint);
----

== Description

Return the address of the node before which the specified `value` should be inserted into the specified `tree`, using the specified `hint` to improve performance when it is the immediate successor&period;

== Return Value

address of the node that would be the parent of `value`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *insertAsLeftChildFlag*
| set to whether `value` is a left child
| *tree*
| tree in which to locate the insert parent
| *comparator*
| functor used to order nodes against `value`
| *value*
| value whose insert location is returned
| *hint*
| possible immediate successor of `value` in `tree`
|===


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