std::flat_multimap::end,(3)
π NAME π
Okay bestie, this is the std::flat_multimap::end page β page std::flat_multimap::end,(3) β from the C++ Standard Library manual. The NAME line is literally:
std::flat_multimap::end, - std::flat_multimap::end,
Commas included. No, I'm not gaslighting you π .
πΈ Synopsis πΈ
All three overloads are noexcept, and all three are since C++23:
iterator end() noexcept; (1) (since C++23)
const_iterator end() const noexcept; (2) (since C++23)
const_iterator cend() const noexcept; (3) (since C++23)
So what does it do? It returns an iterator to the element following the last element of the flat_multimap. Periodt.
β οΈ That element is a placeholder, and attempting to access it results in undefined behavior. Not cute, not safe, do not.
The source also has a diagram named range-begin-end.svg right here β consider it mentioned so it doesn't get lost π¦.
π Parameters π
(none) β literally none, bestie. No arguments, no stress.
β¨ Return value β¨
Iterator to the element following the last element.
π¦ Complexity π¦
Constant. O(1) energy, we love to see it β.
π Example π
The source says // Run this code right before this block, so here's the example:
#include <iostream>
#include <flat_map>
int main()
{
std::flat_multimap<int, int> map{{4, 13}, {9, 94}, {1, 19}, {4, 42}};
for (auto it = map.cbegin(); it != map.cend(); ++it)
std::cout << '[' << it->first << "] = " << it->second << '\n';
// Unlike std::multimap's bidirectional iterators, the std::flat_multimap
// iterators are random-access, so they can be used with the operator[]:
auto it = map.cbegin();
assert(it[1] == 19);
assert(it[4] == 13);
assert(it[4] == 42);
assert(it[9] == 94);
}
β Output β
[1] = 19
[4] = 13
[4] = 42
[9] = 94
π See also π
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)
Source/version: http://cppreference.com β’ date: 2024.06.10 β’ page: std::flat_multimap::end,(3). Bye bestie, go slay those iterators π«Άβ¨π
π¦ 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