Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1017 Bytes

File metadata and controls

58 lines (43 loc) · 1017 Bytes

at

  • stacktrace[meta header]
  • std[meta namespace]
  • basic_stacktrace[meta class]
  • function[meta id-type]
  • cpp23[meta cpp]
const_reference at(size_type frame_no) const; // (1) C++23

概要

任意の位置の要素を取得する。

戻り値

保持しているスタックトレースの履歴の、frame_no番目の要素を返す。

例外

frame_no >= size()である場合、std::out_of_range例外を送出する。

#include <iostream>
#include <stacktrace>

void g() {
  std::stacktrace st = std::stacktrace::current();
  std::cout << st.at(0) << std::endl;
}

void f() {
  g();
}

int main() {
  f();
}
  • st.at[color ff0000]
  • current()[link current.md]

出力例 (GCC)

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

バージョン

言語

  • C++23

処理系