std::unorde...ltimap::end,(3)
πΈ NAME πΈ
okay bestie, welcome to std::unorde...ltimap::end,(3) from the C++ Standard Libary (yes, thatβs the spelling on the page, sheβs quirky π
). This page is about std::unordered_multimap::end β and the NAME line literally says std::unordered_multimap::end, - std::unordered_multimap::end, (yes, twice, and we respect the repetition π).
β¨ Synopsis β¨
okay so the signatures are giving overload-family realness:
iterator end() noexcept; (1) (since C++11)
const_iterator end() const noexcept; (2) (since C++11)
const_iterator cend() const noexcept; (3) (since C++11)
Each one returns an iterator to the element following the last element of the unordered_multimap.
That element acts as a placeholder, bestie β attempting to access it results in undefined behavior. Not me warning you dramatically: do not touch the placeholder π.
Thereβs also a range-begin-end.svg reference here too, just vibing in the original. π¦
π Parameters π
(none) β literally none, no arguments, we love a no-param moment.
π Return value π
An iterator to the element following the last element. Periodt.
π« Complexity π«
Constant. literally constant, no cap. β
π Example π
hereβs the whole code, copied exactly so you can run it and feel iconic:
#include <algorithm>
#include <cassert>
#include <iostream>
#include <string>
#include <utility>
#include <unordered_map>
int main()
{
auto show_node = [](const std::pair<std::string, std::string>&
node)
{
std::cout << node.first << " : " << node.second << '\n';
};
std::unordered_multimap<std::string, std::string> lemmas;
assert(lemmas.begin() == lemmas.end());
assert(lemmas.cbegin() == lemmas.cend());
lemmas.insert({ "1. βx β N βy β N", "x β€ y" });
show_node(*lemmas.cbegin());
assert(lemmas.begin() != lemmas.end());
assert(lemmas.cbegin() != lemmas.cend());
lemmas.begin()->second = "x < y";
show_node(*lemmas.cbegin());
lemmas.insert({ "2. βx, y β N ", "x = y V x β y" });
show_node(*lemmas.cbegin());
lemmas.insert({ "3. βx β N βy β N", "y = x + 1" });
show_node(*lemmas.cbegin());
std::cout << "Lemmas: \n";
std::for_each(lemmas.cbegin(), lemmas.cend(), [&](const auto& n)
{
show_node(n);
});
std::cout << '\n';
}
π Possible output: π
and it might print exactly this:
1. βx β N βy β N : x β€ y
1. βx β N βy β N : x < y
2. βx, y β N : x = y V x β y
3. βx β N βy β N : y = x + 1
Lemmas:
3. βx β N βy β N : y = x + 1
1. βx β N βy β N : x < y
2. βx, y β N : x = y V x β y
π See also π
the original See also section is a little chaotic, so here are all the tokens exactly as they show up:
beginβ returns an iterator to the beginningcbeginβ(public member function)endcendβ returns an iterator to the end of a container or array(C++11)β(function template)(C++14)
xoxo, your Unix bestie π source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::unorde...ltimap::end,(3) β¨
π¦ 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