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

`insert&lowbar;or&lowbar;assign` overloads

== Synopses

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

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


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/pair-0b.adoc[pair&lt;map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator, bool&gt;]
xref:bsl/map-0a7/insert_or_assign-08.adoc[insert&lowbar;or&lowbar;assign](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;KEY&gt;] key,
    BDE&lowbar;OTHER&lowbar;TYPE&& obj);
----

[.small]#xref:bsl/map-0a7/insert_or_assign-08.adoc[_» more&period;&period;&period;_]#

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


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/pair-0b.adoc[pair&lt;map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator, bool&gt;]
xref:bsl/map-0a7/insert_or_assign-0e.adoc[insert&lowbar;or&lowbar;assign](
    KEY const& key,
    BDE&lowbar;OTHER&lowbar;TYPE&& obj);
----

[.small]#xref:bsl/map-0a7/insert_or_assign-0e.adoc[_» more&period;&period;&period;_]#

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


[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;]
xref:bsl/map-0a7/insert_or_assign-096.adoc[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;
----

[.small]#xref:bsl/map-0a7/insert_or_assign-096.adoc[_» more&period;&period;&period;_]#

Insert or assign near `hint` using a movable `key`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
xref:bsl/map-0a7/insert_or_assign-093.adoc[insert&lowbar;or&lowbar;assign](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;KEY&gt;] key,
    BDE&lowbar;OTHER&lowbar;TYPE&& obj);
----

[.small]#xref:bsl/map-0a7/insert_or_assign-093.adoc[_» more&period;&period;&period;_]#

Insert or assign near `hint` using `key` and `obj`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
xref:bsl/map-0a7/insert_or_assign-06.adoc[insert&lowbar;or&lowbar;assign](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    KEY const& key,
    BDE&lowbar;OTHER&lowbar;TYPE&& obj);
----

[.small]#xref:bsl/map-0a7/insert_or_assign-06.adoc[_» more&period;&period;&period;_]#

Insert or assign near `hint` using a transparent `key`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class LOOKUP&lowbar;KEY,
    class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:bsl/map-0a7/iterator.adoc[iterator]
xref:bsl/map-0a7/insert_or_assign-0c.adoc[insert&lowbar;or&lowbar;assign](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    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;
----

[.small]#xref:bsl/map-0a7/insert_or_assign-0c.adoc[_» more&period;&period;&period;_]#

== Return Value

* pair of iterator and whether a new element was inserted
* iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| key to move into the element
| *obj*
| mapped value to assign or insert
| *hint*
| iterator hint for the insertion position
|===


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