• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <stacktrace>

    std::basic_stacktrace::operator<<

    namespace std {
      template <class charT, class traits, class Allocator>
      basic_ostream<charT, traits>&
        operator<<(basic_ostream<charT, traits>& os,
                   const basic_stacktrace<Allocator>& st);
    

    概要

    出力ストリームに出力する。

    効果

    以下と等価:

    return os << to_string(st);
    

    #include <iostream>
    #include <stacktrace>
    
    void g() {
      std::cout << std::stacktrace::current() << std::endl;
    }
    
    void f() {
      g();
    }
    
    int main() {
      f();
    }
    

    出力例 (GCC)

       0#  g() at /app/example.cpp:5
       1#  f() at /app/example.cpp:9
       2# main at /app/example.cpp:13
       3#      at :0
       4#      at :0
       5# _start at :0
       6# 
    

    バージョン

    言語

    • C++23

    処理系