我想使用 C++17 的新并行设施,但我的计算机不这样做。
\n这有效:
\nfinalOutline.push_back(std::accumulate(intermediateCoefs.begin(), intermediateCoefs.end(),origin,[](sf::Vector2f prev, sf::Vector2f current) {\n return sf::Vector2f(current.x + prev.x, current.y + prev.y);\n }));\nRun Code Online (Sandbox Code Playgroud)\n但这不起作用:
\nfinalOutline.push_back(std::accumulate(std::execution::seq, intermediateCoefs.begin(), intermediateCoefs.end(),origin,[](sf::Vector2f prev, sf::Vector2f current) {\n return sf::Vector2f(current.x + prev.x, current.y + prev.y);\n }));\nRun Code Online (Sandbox Code Playgroud)\n这里是错误消息:
\n/home/mbs/Bureau/cplusplusWorkspace/sauvegardeGit/compresse-moi-ces-cercles/src/Model.cpp: In member function \xe2\x80\x98void Model::computeFinalOutline(int)\xe2\x80\x99:\n/home/mbs/Bureau/cplusplusWorkspace/sauvegardeGit/compresse-moi-ces-cercles/src/Model.cpp:246:47: error: no matching function for call to \xe2\x80\x98accumulate(const __pstl::execution::v1::sequenced_policy&, std::vector<sf::Vector2<float> >::iterator, std::vector<sf::Vector2<float> >::iterator, sf::Vector2f&, Model::computeFinalOutline(int)::<lambda(sf::Vector2f, sf::Vector2f)>)\xe2\x80\x99\n 246 | finalOutline.push_back(std::accumulate(std::execution::seq, intermediateCoefs.begin(), intermediateCoefs.end(),origin,[](sf::Vector2f prev, sf::Vector2f current) {\n | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n 247 | return sf::Vector2f(current.x + prev.x, …Run Code Online (Sandbox Code Playgroud)