std::unorde...emplace_hint(3)
std::unorde...emplace_hint(3) π
okay so this is the C++ Standard Libary page for std::unordered_multimap::emplace_hint, bestie β the header title is std::unorde...emplace_hint(3), and we are about to make it make sense β¨.
β¨ NAME β¨
std::unordered_multimap::emplace_hint - std::unordered_multimap::emplace_hint. that's the whole name, and yes it's a mouthful, but we love her π.
πΈ Synopsis πΈ
the vibe check: this is a template member thingy since C++11, and the signature is exactly:
template< class... Args > (since C++11)
iterator emplace_hint( const_iterator hint, Args&&... args );
okay so what it does: it inserts a new element into the container, using hint as a suggestion where the element should go π«Ά.
the constructor of the element type (value_type, that is, std::pair<const Key, T>) is called with exactly the same arguments as supplied to the function, forwarded with std::forward<Args>(args)... β¨.
rehashing tea: 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. periodt.
π Parameters π
hintβ iterator, used as a suggestion as to where to insert the new element π.argsβ arguments to forward to the constructor of the element π.
π«Ά Return value π«Ά
an iterator to the inserted element. lowkey perfect, she's serving exactly what she says π .
π Exceptions π
if an exception is thrown for any reason, this function has no effect β strong exception safety guarantee, no cap π‘οΈβ¨.
π₯ Complexity π₯
Amortized constant on average, worst case linear in the size of the container. so usually chill, but bestie do not forget the worst case, highkey π.
π Example π
okay so the example section is literally giving unfinished homework:
This section is incomplete Reason: no example
not me side-eyeing the empty example box π.
π See also π
emplaceβ constructs element in-place (public member function) π.insertβ inserts elements or nodes (since C++17) (public member function) π.
π Category π
Category: * Todo no example β yep, that's the category, and it's giving "we'll finish this later" energy π.
okay bye bestie, source/version: http://cppreference.com; date: 2024.06.10; header title: std::unorde...emplace_hint(3) β slay and stay safe πβ¨
π¦ 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