bsl::map::insert

insert overloads

Synopses

Declared in <bslstl_map.h>

Insert a movable value if its key is absent.

pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
insert(BloombergLP::bslmf::MovableRef<value_type> value);
» more...

Insert elements from values whose keys are not already present.

void
insert(std::initializer_list<value_type> values);
» more...

Insert a copy of value if its key is absent.

pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
insert(value_type const& value);
» more...

Insert an element constructed from value if its key is absent.

template<class ALT_VALUE_TYPE>
pair<iterator, bool>
insert(ALT_VALUE_TYPE&& value)
requires std::is_constructible<value_type,
                                             ALT_VALUE_TYPE&&>::value;
» more...

Insert a movable value near hint if its key is absent.

map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
insert(
    const_iterator hint,
    BloombergLP::bslmf::MovableRef<value_type> value);
» more...

Insert a copy of value near hint if its key is absent.

map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
insert(
    const_iterator hint,
    value_type const& value);
» more...

Insert elements from [first, last)] whose keys are not already present.

template<class INPUT_ITERATOR>
void
insert(
    INPUT_ITERATOR first,
    INPUT_ITERATOR last);
» more...

Insert a convertible value near hint if its key is absent.

template<class ALT_VALUE_TYPE>
iterator
insert(
    const_iterator hint,
    ALT_VALUE_TYPE&& value)
requires std::is_constructible<value_type,
                                             ALT_VALUE_TYPE&&>::value;
» more...

Return Value

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

Parameters

NameDescription
valueelement to move-insert
valuesinitializer list of elements to insert
hintiterator hint for the insertion position
firstbeginning of the range to insert
lastend of the range to insert