• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <atomic>

    std::atomic_ref::operator T

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

    operator T() const noexcept;
    

    概要

    Tへの暗黙の型変換

    戻り値

    load()

    例外

    投げない

    #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++20

    処理系

    参照