std::operator<<(std::basic_stacktrace)
来自cppreference.com
< cpp | utility | basic
stacktrace
诊断库
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::basic_stacktrace
| 成员函数 | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| 迭代器 | ||||
|
(C++23)(C++23)
|
||||
|
(C++23)(C++23)
|
||||
|
(C++23)(C++23)
|
||||
|
(C++23)(C++23)
|
||||
| 容量 | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| 元素访问 | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| 修改器 | ||||
|
(C++23)
|
||||
| 非成员函数 | ||||
|
(C++23)(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
operator<<
(C++23)
|
||||
| 辅助类 | ||||
|
(C++23)
|
|
在标头
<stacktrace>
定义
|
||
|
template< class CharT, class Traits, class
Allocator >
std::basic_ostream<CharT, Traits>& operator<<( std::basic_ostream<CharT, Traits>& os, |
(C++23 起) | |
插入 st 的描述到输出流 os 中。等价于 return os << std::to_string(st); 。
参数
| os | - | 输出流 |
| st | - | 要插入其描述的 basic_stacktrace
|
返回值
os 。
异常
可能会抛出由实现定义的异常。
注解
由于 std::string 只能由 std::ostream
输出(例如不能由 std::wostream ),这等效地要求 os 的类型为
std::ostream& 。
示例
运行此代码
可能的输出:
The stacktrace obtained in the main function: 0# 0x0000000000402E7B in ./prog.exe 1# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 2# 0x0000000000402CD9 in ./prog.exe The stacktrace obtained in a nested lambda: 0# 0x0000000000402DDA in ./prog.exe 1# 0x0000000000402EB2 in ./prog.exe 2# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 3# 0x0000000000402CD9 in ./prog.exe
参阅
|
(C++23)
|
进行 stacktrace_entry 的流输出 (函数模板) |