Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 968 Bytes

File metadata and controls

52 lines (41 loc) · 968 Bytes

hardware_concurrency

  • thread[meta header]
  • std[meta namespace]
  • jthread[meta class]
  • function[meta id-type]
  • cpp20[meta cpp]
[[nodiscard]] static unsigned int hardware_concurrency() noexcept; // (1) C++20

概要

処理系によりサポートされるスレッド並行数を取得する。

戻り値

return thread::hardware_concurrency();
  • thread[link /reference/thread/thread.md]
  • hardware_concurrency()[link /reference/thread/thread/hardware_concurrency.md]

例外

送出しない。

#include <iostream>
#include <thread>

int main()
{
  std::cout << "concurrency=" << std::jthread::hardware_concurrency() << std::endl;
  return 0;
}
  • hardware_concurrency()[color ff0000]

出力例

concurrency=12

バージョン

言語

  • C++20

処理系