[#bsl-map-0a7-insert_or_assign-096]
= xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::insert&lowbar;or&lowbar;assign
:relfileprefix: ../../
:mrdocs:

Insert or assign using a transparent `key` and `obj`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class LOOKUP&lowbar;KEY,
    class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/pair-0b.adoc[pair&lt;iterator, bool&gt;]
insert&lowbar;or&lowbar;assign(
    LOOKUP&lowbar;KEY&& key,
    BDE&lowbar;OTHER&lowbar;TYPE&& obj)
requires BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;COMPARATOR,
                                                   LOOKUP&lowbar;KEY&gt;&colon;&colon;value;
----

== Description

If a key equivalent to the specified `key` already exists in this map, assign the specified `obj` to the value associated with that key, and return a pair containing an iterator referring to the existing item and `false`&period; Otherwise, insert into this map a newly&hyphen;created `value&lowbar;type` object, constructed from &grave;(std&colon;&colon;forward&lt;KEY&gt;(key), std&colon;&colon;forward&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;(obj)&period;&period;&period;))&grave;, and return a pair containing an iterator referring to the newly&hyphen;created entry and `true`&period;

== Return Value

pair of iterator and whether a new element was inserted

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| transparent key for the element
| *obj*
| mapped value to assign or insert
|===


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