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

  1. リファレンス
  2. atomic
  3. atomic
  4. fetch_fmaximum_num

最終更新日時: 2026年08月07日 21時35分44秒 (JST)
rotarymars が更新

履歴 編集

function
<atomic>

std::atomic::fetch_fmaximum_num(C++26)

constexpr T
  fetch_fmaximum_num(difference_type operand,
                     memory_order order = memory_order_seq_cst
                     ) noexcept;                               // (1) C++26

概要

最大値を設定・取得する。

この関数は、*thisが保持する値とoperandの大きい方を求め、その値をthisに保持させる。戻り値は変更前の値である。

効果

orderで指定されたメモリオーダーにしたがって、*thisが保持する値とoperandの最大値を求めて、その値でアトミックに置き換える

戻り値

変更前の値が返される

例外

投げない

備考

  • この関数は、atomicクラスの浮動小数点数型に対する特殊化で定義される
  • 浮動小数点数型
    • std::fmaximum_num()関数と同様の動作をする

例

#include <iostream>
#include <atomic>

int main()
{
  std::atomic<double> x(2);

  double ret = x.fetch_fmaximum_num(3);

  std::cout << ret << std::endl;
  std::cout << x.load() << std::endl;
}

出力

2
3

バージョン

言語

  • C++26

処理系

  • Clang: 21 ❌
  • GCC: 15 ❌

参照

  • P3008R6 Atomic floating-point min/max
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.