Python os.cpu_count() 的现代 C++ 等价物

Python 的 C++ 等价物(自 2011 年的 C++11 起)

example.py
os.cpu_count()

hardware_concurrency.cpp
#include <thread>

std::thread::hardware_concurrency()

另见 cppreference.com 上 std::thread::hardware_concurrency() 的文档


Check out similar posts by category: C/C++