小编Gre*_*oit的帖子

C++ std::accumulate 与策略执行未找到

我想使用 C++17 的新并行设施,但我的计算机不这样做。

\n

这有效:

\n
finalOutline.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        }));\n
Run Code Online (Sandbox Code Playgroud)\n

但这不起作用:

\n
finalOutline.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        }));\n
Run 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)

c++ policy execution accumulate c++17

1
推荐指数
1
解决办法
468
查看次数

标签 统计

accumulate ×1

c++ ×1

c++17 ×1

execution ×1

policy ×1