std::basic_...ce::crbegin(3)
π¦ std::basic_stacktrace::rbegin / std::basic_stacktrace::crbegin π¦
Okay bestie, this page is from the C++ Standard Libary manual (that's the manual name as it appears, spelling included π
), and the page title is std::basic_...ce::crbegin(3). We're talking about rbegin and crbegin on std::basic_stacktrace, and yes, both are since C++23. Periodt.
π NAME π
std::basic_stacktrace::rbegin,std::basic_stacktrace::crbegin β and then, literally, the exact same name again: std::basic_stacktrace::rbegin,std::basic_stacktrace::crbegin. No extra lore, that's the whole NAME section.
β¨ Synopsis β¨
Here's the signature situation, bestie:
const_reverse_iterator rbegin() const noexcept; (1) (since C++23)
const_reverse_iterator crbegin() const noexcept; (2) (since C++23)
So both of these return a reverse iterator to the first entry of the reversed basic_stacktrace. It corresponds to the last entry of the original basic_stacktrace. And if the basic_stacktrace is empty, the returned iterator is equal to rend().
The original page also drops a diagram named range-rbegin-rend.svg β yes, that's the literal filename β to show the rbegin/rend range vibe. π«Ά
πΈ Parameters πΈ
(none) β not a single argument, not one optional extra. It's giving no-arg icon behavior. π
π Return value π
Reverse iterator to the first entry. That's the whole return value, and it ate. β¨
π Complexity π
Constant. No cap, constant. π§
π₯ Example π₯
The page says // Run this code, so here's the code, copied exactly:
#include <algorithm>
#include <iostream>
#include <stacktrace>
int main()
{
auto trace = std::stacktrace::current();
auto empty_trace = std::stacktrace{};
// Print stacktrace.
std::for_each(trace.rbegin(), trace.rend(),
[](const auto& f) { std::cout << f << '\n'; });
if (empty_trace.rbegin() == empty_trace.rend())
std::cout << "stacktrace 'empty_trace' is indeed empty.\n";
}
Possible output:
0x0000000000402A29 in ./prog.exe
__libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
0x0000000000402BA5 in ./prog.exe
stacktrace 'empty_trace' is indeed empty.
π See also π
rendβ returns a reverse iterator to the endcrendβ (public member function)
And that's the whole page, bestie! Source/version/date: http://cppreference.com, 2024.06.10, page std::basic_...ce::crbegin(3). Mwah πβ¨
π¦ 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