[#BloombergLP-bslstl-HashTable-06-insertIfMissing-00d] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable-06.adoc[HashTable]::insertIfMissing :relfileprefix: ../../../ :mrdocs: `insertIfMissing` overloads == Synopses Declared in `<bslstl_hashtable.h>` Same as the `insertIfMissing` overload taking `const KeyType&`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-02.adoc[insertIfMissing](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<NonConstKeyType>] key); ---- [.small]#xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-02.adoc[_» more..._]# Insert into this hash‐table a newly‐created `ValueType` object, constructed by forwarding the specified `key` and a default‐constructed object of the type `ValueType::second_type`, to the corresponding constructor of `ValueType`, if `key` does not already exist in this hash‐table. Return the address of the (possibly newly created and inserted) element in this hash‐table whose key is equivalent to `key`. If this hash‐table contains more than one element with the supplied `key`, return the first such element (from the contiguous sequence of elements having a matching key). Additional buckets are allocated, as needed, to preserve the invariant `loadFactor <= maxLoadFactor`. If this function tries to allocate a number of buckets larger than can be represented by this hash table's `SizeType`, a `std::length_error` exception is thrown. This method requires that the `ValueType` defined in the (template parameter) type `KEY_CONFIG` be `emplace‐constructible` into this hash‐table from a `pair` of arguments representing the key and value, respectively (see {Requirements on `KEY_CONFIG`}); [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-0548.adoc[insertIfMissing](xref:BloombergLP/bslstl/HashTable-06/KeyType.adoc[KeyType] const& key); ---- [.small]#xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-0548.adoc[_» more..._]# Insert the specified `value` into this hash‐table if a key equivalent to that of `value` does not already exist in this hash‐table. Return the address of the (possibly newly inserted) element in this hash‐table whose key is equivalent to that of `value`. `value` is left in a valid but unspecified state. If this hash‐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). Additional buckets are allocated, as needed, to preserve the invariant `loadFactor <= maxLoadFactor`. If this function tries to allocate a number of buckets larger than can be represented by this hash‐table's `SizeType`, a `std::length_error` exception is thrown. This method requires that the `ValueType` defined in the (template parameter) type `KEY_CONFIG` be `move‐insertable` into this hash‐table (see {Requirements on `KEY_CONFIG`}); [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-06.adoc[insertIfMissing]( bool* isInsertedFlag, xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<ValueType>] value); ---- [.small]#xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-06.adoc[_» more..._]# Insert the specified `value` into this hash‐table if a key equivalent to that of `value` does not already exist in this hash‐table. Return the address of the (possibly newly inserted) element in this hash‐table whose key is equivalent to that of `value`. If this hash‐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). Additional buckets are allocated, as needed, to preserve the invariant `loadFactor <= maxLoadFactor`. If this function tries to allocate a number of buckets larger than can be represented by this hash‐table's `SizeType`, a `std::length_error` exception is thrown. This method requires that the `ValueType` defined in the (template parameter) type `KEY_CONFIG` be `copy‐insertable` into this hash‐table (see {Requirements on `KEY_CONFIG`}); [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-0549.adoc[insertIfMissing]( bool* isInsertedFlag, xref:BloombergLP/bslstl/HashTable-06/ValueType.adoc[ValueType] const& value); ---- [.small]#xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-0549.adoc[_» more..._]# Insert into this hash‐table a `ValueType` object created from the specified `value` if a key equivalent to that of such an object does not already exist in this hash‐table. Return the address of the (possibly newly inserted) element in this hash‐table whose key is equivalent to that of the object created from `value`. Load `true` into the specified `isInsertedFlag` if a new value was inserted, and `false` if an equivalent key was already present. If this hash‐table contains more than one element with an equivalent key, return the first such element (from the contiguous sequence of elements having a matching key). Additional buckets are allocated, as needed, to preserve the invariant `loadFactor <= maxLoadFactor`. If this function tries to allocate a number of buckets larger than can be represented by this hash‐table's `SizeType`, a `std::length_error` exception is thrown. This method requires that the `ValueType` defined in the (template parameter) type `KEY_CONFIG` be `move‐insertable` into this hash‐table (see {Requirements on `KEY_CONFIG`}) and the (template parameter) type `SOURCE_TYPE` be implicitly convertible to `ValueType`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class SOURCE_TYPE> xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-005.adoc[insertIfMissing]( bool* isInsertedFlag, SOURCE_TYPE&& value); ---- [.small]#xref:BloombergLP/bslstl/HashTable-06/insertIfMissing-005.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#