我可以std::transform_reduce在 Fedora 和 Ubuntu 上使用gcc 9.2.1编译以下代码(使用),但是尝试在 clang see godbolt上编译失败,并且我收到报告说 gcc 9.2.1 的某些 FSF 版本也拒绝编译代码,需要 astd::execution_policy作为 的第一个参数std::transform_reduce。
#include <vector>
#include <algorithm>
#include <numeric>
auto brokenvector(std::vector<int> const& a, std::vector<int> const& b)
{
return std::transform_reduce(cbegin(a), cend(a), cbegin(b), 0, std::plus<>{},std::multiplies<>{});
}
Run Code Online (Sandbox Code Playgroud)
我特别不能在std::execution_policy这里使用 a ,并且cppreference和 C++ 草案标准文档 n4659 都显示了没有执行策略的重载。
我是否进入了某种政治雷区,其中一半可用的编译器拒绝实施该标准,或者代码不正确?
| 归档时间: |
|
| 查看次数: |
231 次 |
| 最近记录: |