std::operator<<(std::stacktrace_entry)
来自cppreference.com
                    
                                        
                    < cpp | utility | stacktrace entry
                    
                                                            
                    |   在标头  <stacktrace> 定义
  | 
||
|   template< class CharT, class Traits > std::basic_ostream<CharT, Traits>&  | 
(C++23 起) | |
插入 f 的描述到输出流 os 中。等价于 return os << std::to_string(f); 。
参数
| os | - | 输出流 | 
| f | - |   要插入其描述的 stacktrace_entry
 | 
返回值
os 。
异常
可能会抛出由实现定义的异常。
注解
由于 std::string 只能由 std::ostream 输出(例如不能由 std::wostream ),这等效地要求 os 的类型为 std::ostream& 。
示例
运行此代码
#include <stacktrace> #include <iostream> int main() { for (const auto &f : std::stacktrace::current()) std::cout << f << '\n'; }
可能的输出:
0x0000000000402AA7 in ./prog.exe __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 0x00000000004029B9 in ./prog.exe
参阅
|    (C++23)  | 
   进行 basic_stacktrace 的流输出 (函数模板)  |