Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.08 KB

File metadata and controls

58 lines (43 loc) · 1.08 KB

max

  • semaphore[meta header]
  • std[meta namespace]
  • counting_semaphore[meta class]
  • function[meta id-type]
  • cpp20[meta cpp]
static constexpr ptrdiff_t max() noexcept;
  • ptrdiff_t[link /reference/cstddef/ptrdiff_t.md]

概要

カウンティングセマフォが取り扱えるカウンタの最大値

戻り値

カウンタの最大値を返す。

カウンタの最大値はテンプレートパラメータleast_max_valueと等しいか、それ以上の値となる。

例外

投げない

#include <iostream>
#include <semaphore>

int main()
{
  using Semaphore = std::counting_semaphore<10>;
  std::cout << Semaphore::max() << std::endl;

  // 処理系定義のデフォルト値
  std::cout << std::counting_semaphore<>::max() << std::endl;
}
  • max()[color ff0000]

出力例

10
2147483647

バージョン

言語

  • C++20

処理系