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

履歴 編集

function
<atomic>

std::atomic_ref::operator value_type(C++26)

constexpr operator value_type() const noexcept; // (1) C++26

概要

value_typeへの暗黙の型変換

戻り値

load()

例外

投げない

備考

  • C++26で、CV修飾された型を受け取れるようにするため、型Tへの変換演算子から、型value_typeへの変換演算子に変更された

#include <iostream>
#include <atomic>

int main()
{
  int value = 1;
  std::atomic_ref<int> x{value};

  int n = x;
  std::cout << n << std::endl;
}

出力

1

バージョン

言語

  • C++26

処理系

参照