bsl::map::insert_or_assign

insert_or_assign overloads

Synopses

Declared in <bslstl_map.h>

Insert or assign using a movable key and obj.

template<class BDE_OTHER_TYPE>
pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
insert_or_assign(
    BloombergLP::bslmf::MovableRef<KEY> key,
    BDE_OTHER_TYPE&& obj);
» more...

Insert or assign using key and obj.

template<class BDE_OTHER_TYPE>
pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
insert_or_assign(
    KEY const& key,
    BDE_OTHER_TYPE&& obj);
» more...

Insert or assign using a transparent key and obj.

template<
    class LOOKUP_KEY,
    class BDE_OTHER_TYPE>
pair<iterator, bool>
insert_or_assign(
    LOOKUP_KEY&& key,
    BDE_OTHER_TYPE&& obj)
requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
                                                   LOOKUP_KEY>::value;
» more...

Insert or assign near hint using a movable key.

template<class BDE_OTHER_TYPE>
map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
insert_or_assign(
    const_iterator hint,
    BloombergLP::bslmf::MovableRef<KEY> key,
    BDE_OTHER_TYPE&& obj);
» more...

Insert or assign near hint using key and obj.

template<class BDE_OTHER_TYPE>
map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
insert_or_assign(
    const_iterator hint,
    KEY const& key,
    BDE_OTHER_TYPE&& obj);
» more...

Insert or assign near hint using a transparent key.

template<
    class LOOKUP_KEY,
    class BDE_OTHER_TYPE>
iterator
insert_or_assign(
    const_iterator hint,
    LOOKUP_KEY&& key,
    BDE_OTHER_TYPE&& obj)
requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
                                                   LOOKUP_KEY>::value;
» more...

Return Value

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

Parameters

NameDescription
keykey to move into the element
objmapped value to assign or insert
hintiterator hint for the insertion position