std::hive<T,Allocator>::insert
From cppreference.com
iterator insert( const T& value );
|
(1) | (since C++26) |
iterator insert( T&& value );
|
(2) | (since C++26) |
iterator insert( const_iterator hint, const T& value );
|
(3) | (since C++26) |
iterator insert( const_iterator hint, T&& value );
|
(4) | (since C++26) |
void insert( std::initializer_list<T> ilist );
|
(5) | (since C++26) |
template< class InputIter >
void insert( InputIter first, InputIter last );
|
(6) | (since C++26) |
void insert( size_type count, const T& value );
|
(7) | (since C++26) |
Inserts elements into the hive at unspecified location.
1,3) Inserts a copy of
value.2,4) Inserts
value, possibly using move semantics as if by emplace(std::forward<decltype(x)>(x));.5) Inserts elements from initializer list
ilist.6) Inserts the elements from range
[first, last). Equivalent toinsert_range(ranges::subrange(first, last));.
InputIter qualifies as LegacyInputIterator, to avoid ambiguity with the overloads (3,4,7).7) Inserts
count copies of the value.5,6) Each iterator in the input range is dereferenced exactly once.
5,6,7) Exactly one object of type
T is constructed for each inserted element.If an element is inserted, the end() iterator is invalidated.
Parameters
| value | - | element value to insert |
| hint | - | ignored (exists only for compatibility) |
| ilist | - | std::initializer_list to insert the values from |
| first, last | - | the pair of iterators defining the range of elements to insert (cannot be iterators into container for which insert is called) |
| count | - | number of elements to insert |
| Type requirements | ||
-T must meet the requirements of EmplaceConstructible in order to use overloads (1-6).
| ||
-T must meet the requirements of CopyInsertable in order to use overload (7).
|
Return value
1-4) An iterator that points to the new element.
Complexity
1-4) Constant.
5,6) Linear in the number of inserted elements.
7) Linear in
count.Example
| This section is incomplete Reason: no example |
See also
| inserts a range of elements (public member function) | |
| constructs element in-place (public member function) |