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

履歴 編集

function
<stacktrace>

std::stacktrace_entry::operator==(C++23)

friend bool operator==(const stacktrace_entry& x,
                       const stacktrace_entry& y) noexcept;

概要

stacktrace_entry同士の等値比較を行う。

戻り値

xyが同じスタックトレースエントリを表すか、両方が空の場合のみtrueを返す。

備考

  • この演算子により、operator!=が使用可能になる

#include <cassert>
#include <stacktrace>

void g() {
  std::stacktrace st = std::stacktrace::current();
  std::stacktrace_entry a = st[0];
  std::stacktrace_entry b = st[0];
  std::stacktrace_entry c = st[1];

  assert(a == b);
  assert(a != c);
}

void f() {
  g();
}

int main() {
  f();
}

出力

バージョン

言語

  • C++23

処理系

関連項目