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::operator= - cpprefjp C++日本語リファレンス

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

最終更新日時: 2026年07月22日 16時08分23秒 (JST)
rotarymars が更新

履歴 編集

function
<stacktrace>

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

basic_stacktrace& operator=(const basic_stacktrace& other); // (1) C++23

basic_stacktrace& operator=(basic_stacktrace&& other)
  noexcept(
    allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
    allocator_traits<Allocator>::is_always_equal::value
  );                                                        // (2) C++23

概要

  • (1) コピー代入
  • (2) ムーブ代入

例外

  • (1), (2) : 実装は、メモリ確保に失敗した場合にempty()をtrueにすることで例外仕様を強化できる

例

#include <iostream>
#include <stacktrace>
#include <utility>

void g() {
  std::stacktrace st = std::stacktrace::current();

  // (1) コピー代入
  std::stacktrace st2;
  st2 = st;

  // (2) ムーブ代入
  std::stacktrace st3;
  st3 = std::move(st2);

  std::cout << st3[0] << std::endl;
}

void f() {
  g();
}

int main() {
  f();
}

出力例 (GCC)

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

バージョン

言語

  • C++23

処理系

  • Clang: ??
  • GCC: 12 ✅
  • Visual C++: ??
You are visitor 01402520 — 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.