insert overloads
Synopses
Declared in <bslstl_map.h>
Insert into this map the specified value if a key (the first element) equivalent to that of value does not already exist in this map; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of value, and whose second member is true if a new value was inserted and false if the key was already present. This method requires that the (template parameter) types KEY and VALUE both be move‐insertable into this map (see {Requirements on KEY and VALUE}).
Insert into this map the value of each value_type object in the specified values initializer list if a key equivalent to that of the object is not already contained in this map. This method requires that the (template parameter) types KEY and VALUE both be copy‐insertable into this map (see {Requirements on KEY and VALUE}).
void
insert(std::initializer_list<value_type> values);
Insert the specified value into this map if a key (the first element) equivalent to that of value does not already exist in this map; otherwise, if a value_type object whose key is equivalent to that of value already exists in this map, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of value, and whose second member is true if a new value was inserted, and false if the key was already present. This method requires that the (template parameter) types KEY and VALUE both be copy‐insertable into this map (see {Requirements on KEY and VALUE}).
pair<iterator, bool>
insert(value_type const& value);
Insert into this map a value_type object created from the specified value if a key (the first element) equivalent to that of such an object does not already exist in this map; otherwise, this method has no effect (other than possibly creating a temporary value_type object). Return a pair whose first member is an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of the object created from value, and whose second member is true if a new value was inserted and false if the key was already present. This method requires that the (template parameter) types KEY and VALUE both be move‐insertable into this map (see {Requirements on KEY and VALUE}), and the value_type be constructible from the (template parameter) ALT_VALUE_TYPE.
template<class ALT_VALUE_TYPE>
pair<iterator, bool>
insert(ALT_VALUE_TYPE&& value)
requires std::is_constructible<value_type,
ALT_VALUE_TYPE&&>::value;
Insert into this map the specified value (in amortized constant time if the specified hint is a valid immediate successor to value) if a key (the first element) equivalent to that of value does not already exist in this map; otherwise, this method has no effect. Return an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of value. If hint is not a valid immediate successor to value, this operation has O[log(N)] complexity, where N is the size of this map. This method requires that the (template parameter) types KEY and VALUE both be move‐insertable into this map (see {Requirements on KEY and VALUE}). The behavior is undefined unless hint is an iterator in the range [begin() .. end()] (both endpoints included).
Insert the specified value into this map (in amortized constant time if the specified hint is a valid immediate successor to the key of value) if a key (the first element) equivalent to that of value does not already exist in this map; otherwise, if a value_type object whose key is equivalent to that of value already exists in this map, this method has no effect. Return an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of value. If hint is not a valid immediate successor to the key of value, this operation has O[log(N)] complexity, where N is the size of this map. This method requires that the (template parameter) types KEY and VALUE both be copy‐insertable into this map (see {Requirements on KEY and VALUE}). The behavior is undefined unless hint is an iterator in the range [begin() .. end()] (both endpoints included).
iterator
insert(
const_iterator hint,
value_type const& value);
Insert into this map the value of each value_type object in the range starting at the specified first iterator and ending immediately before the specified last iterator, if a key equivalent to that of the object is not already contained in this map. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators]providing access to values of a type convertible to value_type, and value_type must be emplace‐constructible from *i into this map, where i is a dereferenceable iterator in the range [first .. last)] (see {Requirements on KEY and VALUE}). The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last.
template<class INPUT_ITERATOR>
void
insert(
INPUT_ITERATOR first,
INPUT_ITERATOR last);
Insert into this map a value_type object created from the specified value (in amortized constant time if the specified hint is a valid immediate successor to the object created from value) if a key (the first element) equivalent to such an object does not already exist in this map; otherwise, this method has no effect (other than possibly creating a temporary value_type object). Return an iterator referring to the (possibly newly inserted) value_type object in this map whose key is equivalent to that of the object created from value. If hint is not a valid immediate successor to the object created from value, this operation has O[log(N)] complexity, where N is the size of this map. This method requires that the (template parameter) types KEY and VALUE both be move‐insertable into this map (see {Requirements on KEY and VALUE}), and the value_type be constructible from the (template parameter) ALT_VALUE_TYPE. The behavior is undefined unless hint is an iterator in the range [begin() .. end()] (both endpoints included).
template<class ALT_VALUE_TYPE>
iterator
insert(
const_iterator hint,
ALT_VALUE_TYPE&& value)
requires std::is_constructible<value_type,
ALT_VALUE_TYPE&&>::value;
Created with MrDocs