• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    class
    <stacktrace>

    std::formatter

    namespace std {
      struct formatter<stacktrace_entry>;
    }
    

    概要

    stacktrace_entryクラスに対するstd::formatterクラステンプレートの特殊化。

    フォーマットフラグとしては、以下を使用できる:

    [[fill] [align] [width]]
    

    #include <print>
    #include <stacktrace>
    
    void g() {
      std::stacktrace st = std::stacktrace::current(0, 1);
      std::stacktrace_entry entry = st[0];
    
      std::println("{}", entry);
      std::println("{: >30}", entry);
    }
    
    void f() {
      g();
    }
    
    int main() {
      f();
    }
    

    出力

     g() at /app/example.cpp:5
         g() at /app/example.cpp:5
    

    バージョン

    言語

    • C++23

    処理系

    関連項目

    参照