bsl::set::insert

insert overloads

Synopses

Declared in <bslstl_set.h>

Move-insert value if an equivalent key is not already present.

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

Insert each unique value from the values initializer list.

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

Insert value if an equivalent key is not already present.

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

Insert a transparent value if an equivalent key is not present.

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

Move-insert value near hint if an equivalent key is not present.

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

Insert value near hint if an equivalent key is not present.

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

Insert each unique value from the range [first .. last)].

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

Insert a transparent value near hint if not already present.

template<class LOOKUP_KEY>
iterator
insert(
    const_iterator hint,
    LOOKUP_KEY&& value)
requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
                                                   LOOKUP_KEY>::value
        && !bsl::is_convertible<LOOKUP_KEY&&, iterator>::value
        && !bsl::is_convertible<LOOKUP_KEY&&, const_iterator>::value;
» more...

Return Value

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

Parameters

NameDescription
valuekey to move-insert
valuesinitializer list of keys to insert
hintiterator hint for insertion position
firstbeginning of the range (inclusive)
lastend of the range (exclusive)