std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>::insert
Min standard notice:
Inserts element(s) into the container, if the container does not already contain an element with an equivalent key.
# Declarations
std::pair<iterator, bool> insert( const value_type& value );
(since C++23)
std::pair<iterator, bool> insert( value_type&& value );
(since C++23)
iterator insert( const_iterator pos, const value_type& value );
(since C++23)
iterator insert( const_iterator pos, value_type&& value );
(since C++23)
template< class P >
std::pair<iterator, bool> insert( P&& x );
(since C++23)
template< class P >
iterator insert( const_iterator pos, P&& x );
(since C++23)
template< class InputIt >
void insert( InputIt first, InputIt last );
(since C++23)
template< class InputIt >
void insert( std::sorted_unique_t, InputIt first, InputIt last );
(since C++23)
void insert( std::initializer_list<key_type> ilist );
(since C++23)
void insert( std::sorted_unique_t s, std::initializer_list<key_type> ilist );
(since C++23)
# Parameters
pos: an iterator to the position before which the new element will be insertedvalue: an element value to insertfirst, last: a range of elements to insertilist: an initializer list to insert the values fromx: a value of any type that can be transparently compared with a keys: a disambiguation tag indicating that the input sequence is sorted (with respect to value_comp()) and contains only unique elements
# Notes
The hinted insert (3,4,6) does not return a boolean in order to be signature-compatible with positional insert on sequential containers, such as std::vector::insert. This makes it possible to create generic inserters such as std::inserter. One way to check success of a hinted insert is to compare size() before and after.
# Example
This section is incompleteReason: no example