[#BloombergLP-bslstl-HashTable-insertOrAssign] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable.adoc[HashTable]::insertOrAssign :relfileprefix: ../../../ :mrdocs: Insert or assign a mapped value for `key`. == Synopsis Declared in `<bslstl_hashtable.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY_ARG, class BDE_OTHER_TYPE> xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* insertOrAssign( bool* isInsertedFlag, xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* hint, KEY_ARG&& key, BDE_OTHER_TYPE&& obj); ---- == Description If a key equivalent to the specified `key` already exists in this hash‐table, assign the specified `obj` to the value associated with that key, load `false` into the specified `isInsertedFlag` and return a pointer to the existing entry. Otherwise, insert into this hash‐table a newly‐created `value_type` object, constructed from `key` and `obj`, load `true` into `isInsertedFlag`, and return a pointer to the newly‐created entry. Use the optionally specified `hint` as a starting place for the search for the existing key. == Return Value pointer to the existing or newly created entry == Parameters [cols="1,4"] |=== | Name| Description | *isInsertedFlag* | set to `true` if a new entry was inserted | *hint* | optional starting node for the key search | *key* | key to insert or assign | *obj* | mapped value to insert or assign |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#