std::basic_stacktrace<Allocator>::end, std::basic_stacktrace<Allocator>::cend
From cppreference.com
< cpp | utility | basic stacktrace
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Diagnostics library
(until C++20*)
(C++17)(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Exception handling failures
(C++11)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)
(TM TS)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++26)
(C++26)
(C++26)
std::basic_stacktrace
basic_stacktrace::endbasic_stacktrace::cend
const_iterator end() const noexcept;
(1)
(since C++23)
const_iterator cend() const noexcept;
(2)
(since C++23)
Returns the iterator pointing past the last entry of the basic_stacktrace
.
This iterator acts as a placeholder; attempting to dereference it results in undefined behavior.
[edit] Parameters
(none)
[edit] Return value
The end iterator.
[edit] Complexity
Constant.
[edit] Example
Run this code
#include <algorithm> #include <iostream> #include <stacktrace> int main() { auto trace = std::stacktrace::current(); auto empty_trace = std::stacktrace {}; // Print stacktrace. std::for_each (trace.begin(), trace.end(), [](const auto& f) { std::cout << f << '\n'; }); if (empty_trace.begin() == empty_trace.end()) std::cout << "stacktrace 'empty_trace' is indeed empty.\n"; }
Possible output:
0x0000000000402BA8 in ./prog.exe __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 0x0000000000402A29 in ./prog.exe stacktrace 'empty_trace' is indeed empty.