std::operator<<(std::basic_stacktrace)
來自 cppreference.com
< cpp | 工具庫 | basic_stacktrace
定義於標頭檔案 <stacktrace> |
||
template< class Allocator > std::ostream& operator<<( std::ostream& os, const std::basic_stacktrace<Allocator>& st ); |
(C++23 起) | |
將 `st` 的描述插入到輸出流 `os` 中。等同於 return os << std::to_string(st);。
目錄 |
[編輯] 引數
os | - | 一個輸出流 |
st | - | 一個 `basic_stacktrace`,其描述將被插入 |
[編輯] 返回值
os
.
[編輯] 異常
可能丟擲實現定義的異常。
[編輯] 示例
執行此程式碼
可能的輸出
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 的流輸出(函式模板) |