没有执行策略的 std::transform_reduce 是可移植的吗?
Is std::transform_reduce without execution policy portable?
我可以在 Fedora 和 Ubuntu 上使用 gcc 9.2.1 编译以下代码(使用std::transform_reduce
(,但尝试在 clang 上编译看到 godbolt 失败,我有一个报告,一些 FSF 版本的 gcc 9.2.1 也拒绝编译代码,需要std::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<>{});
}
我在这里特别不能使用std::execution_policy
,并且 cpp首选项和C++草案标准文档 n4659 都显示了没有执行策略的重载。
我是否进入了某种政治雷区,一半的可用编译器拒绝实施标准,或者代码不正确?
这是一个libstdc++与libc++的问题。 libc ++实现了这个函数,在这个实时示例中,您可以看到它使用-stdlib=libc++
在Godbolt上与Clang一起工作。 GCC 现在在 Trunk 中实现了它,但当前发布的版本没有。 该函数已添加到此提交中。
相关文章:
- C++Union/Struct位域的实现和可移植性
- 具有Qt事件循环的可移植通用共享库设置
- 没有执行策略的 std::transform_reduce 是可移植的吗?
- 如何在 c++ 中正确指定 #include 路径以使程序可移植
- 创建异构顶点数据数组的可移植方法
- FlatBuffers/Protobuf 中是否有支持任意 24 位有符号整数定义的可移植二进制序列化架构?
- 静态库可移植性
- 从非类型模板参数声明 constexpr 数组的可移植方法
- C++:Unicode 字符串文字的可移植性
- 如何使Visual Studio 2017 C++项目在计算机之间更具可移植性
- 尝试将 sfml 和 c++ 与 Windows 10 上的可移植 vscode 链接起来
- 在C++中获取命名空间名称的任何可移植技巧
- STR这个实现是否安全且可移植?
- 编写 std::copysign 的可移植 SSE/AVX 版本
- 是可移植的包装结构
- 将参数推送到调用堆栈 (C++) 的可移植方法
- 在为视频游戏实施基本的二进制序列化时,请担心可移植性
- 如何以可移植方式删除名称为 wchar_t 类型的文件C++
- Xcode 8.3.2 中的错误警告:文件的非可移植路径 - 指定的路径与磁盘上的文件名不同
- 格式化说明符以可移植地打印 C++11 中的 std::uint64_t 变量