- 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
- Clang: 11.0 [mark verified]
- GCC: ??
- ICC: ??
- Visual C++: ??