std::basic_stacktrace<Allocator>:: begin, std::basic_stacktrace<Allocator>:: cbegin
From cppreference.net
<
cpp
|
utility
|
basic stacktrace
C++
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::basic_stacktrace
| Member functions | ||||
| Iterators | ||||
|
basic_stacktrace::begin
basic_stacktrace::cbegin
|
||||
| Capacity | ||||
| Element access | ||||
| Modifiers | ||||
| Non-member functions | ||||
| Helper classes | ||||
|
const_iterator begin
(
)
const
noexcept
;
|
(1) | (seit C++23) |
|
const_iterator cbegin
(
)
const
noexcept
;
|
(2) | (seit C++23) |
Gibt einen Iterator auf den ersten Eintrag des
basic_stacktrace
zurück.
Wenn der
basic_stacktrace
leer ist, ist der zurückgegebene Iterator gleich
end()
.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
Iterator zum ersten Eintrag.
Komplexität
Konstante.
Beispiel
Diesen Code ausführen
#include <algorithm> #include <iostream> #include <stacktrace> int main() { auto trace = std::stacktrace::current(); auto empty_trace = std::stacktrace{}; // Stacktrace ausgeben. 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"; }
Mögliche Ausgabe:
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.
Siehe auch
|
gibt einen Iterator zum Ende zurück
(öffentliche Elementfunktion) |