std::basic_stacktrace<Allocator>::end, std::basic_stacktrace<Allocator>::cend

来自cppreference.com
 
 
 
 
const_iterator end()  constnoexcept;
(1) (C++23 起)
const_iterator cend()constnoexcept;
(2) (C++23 起)

返回指向 basic_stacktrace 的最后条目后一位置的迭代器。

此迭代器表现为占位符;试图解引用它导致未定义行为。

range-begin-end.svg

目录

[编辑]参数

(无)

[编辑]返回值

尾迭代器。

[编辑]复杂度

常数。

[编辑]示例

#include <algorithm>#include <iostream>#include <stacktrace>   int main(){auto trace = std::stacktrace::current();auto empty_trace =std::stacktrace{};   // 打印 stacktrace 。std::for_each(trace.begin(), trace.end(), [](constauto& 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.

[编辑]参阅

返回指向起始的迭代器
(公开成员函数)[编辑]
close