std::flat_multimap::rend,(3)
okay so this is the std::flat_multimap::rend,(3) page from the C++ Standard Libary manual β welcome to the group chat, bestie π. It's the reverse-end iterator page, and yes, the comma in the name is real, we are keeping it.
π NAME
std::flat_multimap::rend, β that's literally the name, comma and all, no cap. The NAME line says std::flat_multimap::rend, - std::flat_multimap::rend, β yes it repeats itself, we love a self-obsessed icon π
. This is the C++ Standard Libary manual's (3) page for the reverse-end iterator situation on std::flat_multimap.
β¨ Synopsis β¨
Three overloads, all since C++23, bestie:
reverse_iterator rend() noexcept; (1) (since C++23)
const_reverse_iterator rend() const noexcept; (2) (since C++23)
const_reverse_iterator crend() const noexcept; (3) (since C++23)
Returns a reverse iterator to the element following the last element of the reversed flat_multimap. It corresponds to the element preceding the first element of the non-reversed flat_multimap.
This element acts as a placeholder, and attempting to access it results in undefined behavior β so do NOT dereference it, bestie, that's a big yikes π.
The original page also has a diagram named range-rbegin-rend.svg right here β imagine the cutest little reverse-iterator visual, because I can't draw it in terminal π.
π Parameters π
(none), bestie. Zero args, zero stress, just vibes π«Ά.
π₯ Return value π₯
Reverse iterator to the element following the last element. That's the whole tea, slay β¨.
πΈ Complexity πΈ
Constant. literally constant, periodt β no scaling drama.
π¦ Example π¦
okay here's the example, copied exactly because we do not mess with code π :
// Run this code
#include <chrono>
#include <iomanip>
#include <iostream>
#include <string_view>
#include <flat_map>
using namespace std::chrono;
int main()
{
const std::flat_multimap<year_month_day, int> messages
{
{February/17/2023, 10},
{February/17/2023, 20},
{February/16/2022, 30},
{October/22/2022, 40},
{June/14/2022, 50},
{November/23/2021, 60},
{December/10/2022, 55},
{December/12/2021, 45},
{April/1/2020, 42},
{April/1/2020, 24}
};
std::cout << "Messages received (date order is reversed):\n";
for (auto it = messages.crbegin(); it != messages.crend(); ++it)
std::cout << it->first << " : " << it->second << '\n';
}
Possible output:
Messages received (date order is reversed):
2023-02-17 : 20
2023-02-17 : 10
2022-12-10 : 55
2022-10-22 : 40
2022-06-14 : 50
2022-02-16 : 30
2021-12-12 : 45
2021-11-23 : 60
2020-04-01 : 24
2020-04-01 : 42
π See also π
rbeginβ returns a reverse iterator to the beginningcrbeginβ (public member function)rendβ returns a reverse end iterator for a container or arraycrendβ (function template)(C++14)
xoxo, from http://cppreference.com π version/date 2024.06.10, all about std::flat_multimap::rend,(3) β byeee bestie π¦
π¦ 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