std::basic_stacktrace<Allocator>:: end, std::basic_stacktrace<Allocator>:: cend
From cppreference.net
<
cpp
|
utility
|
basic stacktrace
C++
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::basic_stacktrace
| Member functions | ||||
| Iterators | ||||
|
basic_stacktrace::end
basic_stacktrace::cend
|
||||
| Capacity | ||||
| Element access | ||||
| Modifiers | ||||
| Non-member functions | ||||
| Helper classes | ||||
|
const_iterator end
(
)
const
noexcept
;
|
(1) | (自 C++23 起) |
|
const_iterator cend
(
)
const
noexcept
;
|
(2) | (自 C++23 起) |
返回指向
basic_stacktrace
最后条目之后位置的迭代器。
此迭代器作为占位符使用;尝试解引用它将导致未定义行为。
目录 |
参数
(无)
返回值
结束迭代器。
复杂度
常量。
示例
运行此代码
#include <algorithm> #include <iostream> #include <stacktrace> int main() { auto trace = std::stacktrace::current(); auto empty_trace = std::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"; }
可能的输出:
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.
参见
|
返回指向起始位置的迭代器
(公开成员函数) |