std::unorde...iset::insert(3)
π
std::unorde...iset::insert π
okay bestie, welcome to the iconic std::unorde...iset::insert(3) page β it lives in the C++ Standard Libary manual, and we are gonna get you comfy with every single signature, no cap. π
π NAME π
std::unordered_multiset::insert - std::unordered_multiset::insert
(yes bestie, that's the whole name section, we love a minimalist era π )
β¨ Synopsis β¨
iterator insert( const value_type& value ); (1)
(since C++11)
iterator insert( value_type&& value ); (2)
(since C++11)
iterator insert( const_iterator hint, const value_type& value ); (3)
(since C++11)
iterator insert( const_iterator hint, value_type&& value ); (4)
(since C++11)
template< class InputIt > (5)
(since C++11)
void insert( InputIt first, InputIt last );
void insert( std::initializer_list<value_type> ilist ); (6)
(since C++11)
iterator insert( node_type&& nh ); (7)
(since C++17)
iterator insert( const_iterator hint, node_type&& nh ); (8)
(since C++17)
π¬ Description π¬
Inserts element(s) into the container.
1,2)Insertsvalue.3,4)Insertsvalue, usinghintas a non-binding suggestion to where the search should start.5)Inserts elements from range[first, last).6)Inserts elements from initializer listilist.7)Ifnhis an empty node handle, does nothing. Otherwise, inserts the element owned bynhinto the container and returns an iterator pointing at the inserted element. The behavior is undefined ifnhis not empty andget_allocator() != nh.get_allocator().8)Ifnhis an empty node handle, does nothing and returns the end iterator. Otherwise, inserts the element owned bynhinto the container, and returns the iterator pointing to the element with key equivalent tonh.key().hintis used as a non-binding suggestion to where the search should start. The behavior is undefined ifnhis not empty andget_allocator() != nh.get_allocator().
If after the operation the new number of elements is greater than old max_load_factor() * bucket_count() a rehashing takes place. If rehashing occurs (due to the insertion), all iterators are invalidated. Otherwise (no rehashing), iterators are not invalidated. If the insertion is successful, pointers and references to the element obtained while it is held in the node handle are invalidated, and pointers and references obtained to that element before it was extracted become valid. (since C++17)
πΈ Parameters πΈ
hintβ iterator, used as a suggestion as to where to insert the contentvalueβ element value to insertfirst, lastβ range of elements to insertilistβ initializer list to insert the values fromnhβ a compatible node handle
π¦ Type requirements π¦
InputItmust meet the requirements ofLegacyInputIterator.
π Return value π
1-4)An iterator to the inserted element.5,6)(none)7,8)End iterator ifnhwas empty, iterator pointing to the inserted element otherwise.
π₯ Exceptions π₯
1-4)If an exception is thrown by any operation, the insertion has no effect.
This section is incomplete Reason: cases 5,6
π« Complexity π«
1-4)Average case:O(1), worst caseO(size()).5,6)Average case:O(N), whereNis the number of elements to insert. Worst case:O(N * size() + N).7,8)Average case:O(1), worst caseO(size()).
π Example π
This section is incomplete Reason: no example
π See also π
emplaceβ constructs element in-place (public member function)emplace_hintβ constructs elements in-place using a hint (public member function)inserterβ creates astd::insert_iteratorof type inferred from the argument (function template)
π Categories π
- Todo with reason
- Todo no example
okay that's the whole page, bestie π source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::unorde...iset::insert(3) β byeee πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms