GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — std::basic_stacktrace::empty - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. stacktrace
  3. basic_stacktrace
  4. empty

最終更新日時: 2025年02月27日 15時55分09秒 (JST)
Akira Takahashi が更新

履歴 編集

function
<stacktrace>

std::basic_stacktrace::empty(C++23)

[[nodiscard]] bool empty() const noexcept; // (1) C++23
bool empty() const noexcept;               // (1) C++26

概要

スタックトレースの履歴数が空かどうかを判定する。

戻り値

保持しているスタックトレースの履歴が空であればtrue、そうでなければfalseを返す。

例

#include <cassert>
#include <stacktrace>

void g() {
  auto trace = std::stacktrace::current(0, 0);
  assert(trace.empty());
}

void f() {
  g();
}

int main() {
  f();

  std::stacktrace trace{};
  assert(trace.empty());
}

出力

バージョン

言語

  • C++23

処理系

  • Clang: ??
  • GCC: 12 ✅
  • Visual C++: ??

参照

  • P2422R1 Remove nodiscard annotations from the standard library specification
    • C++26で[[nodiscard]]指定が削除された
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.