🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## std::thread 生成多个 ``` #include <functional> #include <iostream> #include <thread> #include <vector> int main() { std::vector<std::thread> t; std::function<void()> f = []() { std::cout << "hello \n"; }; for (int i = 0; i < 10; ++i) { t.push_back(std::thread(f)); } for (auto &thread : t) { thread.join(); } return 0; } ```