我试图使用 C++17 标准中提出的新并行库功能,但我无法让它工作。 I tried compiling with the up-to-date versions of g++ 8.1.1
and clang++-6.0
and -std=c++17
, but neither seemed to support #include <execution>
, std::execution::par
或类似的东西。
在查看并行算法的 cppreference 时,有一长串算法,声称
技术规范从
algorithm
、numeric
和memory
中提供了以下 69 种算法的并行版本: (…长列表…)
听起来算法已经 “在纸上” 准备好了,但还没有准备好使用?
在一年多前的 这个 SO 问题 中,答案声称这些功能尚未实现。但到现在为止,我预计会看到某种实现。有什么我们可以使用的吗?
原文由 Romeo Valentin 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以参考 https://en.cppreference.com/w/cpp/compiler_support 查看所有
C++
功能实现状态。对于您的情况,只需搜索“Standardization of Parallelism TS
”,您会发现只有MSVC
和Intel C++
编译器现在支持此功能。