Insert a copy of value if its key is absent.
Synopsis
Declared in <bslstl_map.h>
pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
insert(value_type const& value);
Description
Insert value if its key is not already present.
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}).
Return Value
pair of iterator and whether a new element was inserted
Parameters
Name |
Description |
value |
element to copy‐insert |
Created with MrDocs