[#BloombergLP-bslstl-HashTable-insertIfMissing-06]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable.adoc[HashTable]::insertIfMissing
:relfileprefix: ../../../
:mrdocs:

Insert a movable `value` if no equivalent key is present&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;hashtable&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]*
insertIfMissing(
    bool* isInsertedFlag,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;ValueType&gt;] value);
----

== Description

Insert the specified `value` into this hash&hyphen;table if a key equivalent to that of `value` does not already exist in this hash&hyphen;table&period; Return the address of the (possibly newly inserted) element in this hash&hyphen;table whose key is equivalent to that of `value`&period; `value` is left in a valid but unspecified state&period; If this hash&hyphen;table contains more than one element with a matching key, return the first such element (from the contiguous sequence of elements having a matching key)&period; Additional buckets are allocated, as needed, to preserve the invariant `loadFactor &lt;&equals; maxLoadFactor`&period; If this function tries to allocate a number of buckets larger than can be represented by this hash&hyphen;table&apos;s `SizeType`, a `std&colon;&colon;length&lowbar;error` exception is thrown&period; This method requires that the `ValueType` defined in the (template parameter) type `KEY&lowbar;CONFIG` be `move&hyphen;insertable` into this hash&hyphen;table (see &lcub;Requirements on `KEY&lowbar;CONFIG`&rcub;)&semi;

== Return Value

address of the (possibly newly inserted) element with an equivalent key

== Parameters

[cols="1,4"]
|===
| Name| Description
| *isInsertedFlag*
| set to `true` if a new entry was inserted
| *value*
| movable value to insert if missing
|===


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