C++17 并行算法是否已经实现?

2023-09-26C/C++开发问题
4

本文介绍了C++17 并行算法是否已经实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我试图尝试使用 C++17 标准中提出的新并行库功能,但我无法让它工作.我尝试使用 g++ 8.1.1clang++-6.0-std=c++17 的最新版本进行编译,但似乎都不支持 #include std::execution::par 或任何类似的东西.

I was trying to play around with the new parallel library features proposed in the C++17 standard, but I couldn't get it to work. 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 or anything similar.

在查看并行算法的 cppreference 时,有一长串算法,声称

When looking at the cppreference for parallel algorithms there is a long list of algorithms, claiming

技术规范提供了来自algorithmnumericmemory的以下69种算法的并行版本:( ... long list...)

Technical specification provides parallelized versions of the following 69 algorithms from algorithm, numeric and memory: ( ... long list ...)

听起来算法已经纸上",但还没有准备好使用?

which sounds like the algorithms are ready 'on paper', but not ready to use yet?

在这个SO问题中一年前,答案声称这些功能尚未实现.但到现在为止,我本来希望看到某种实现.有什么我们可以使用的吗?

In this SO question from over a year ago the answers claim these features hadn't been implemented yet. But by now I would have expected to see some kind of implementation. Is there anything we can use already?

推荐答案

可以参考https://en.cppreference.com/w/cpp/compiler_support 检查所有 C++ 功能实现状态.对于您的情况,只需搜索Standardization of Parallelism TS",您会发现现在只有 MSVCIntel C++ 编译器支持此功能.

You can refer https://en.cppreference.com/w/cpp/compiler_support to check all C++ feature implementation status. For your case, just search "Standardization of Parallelism TS", and you will find only MSVC and Intel C++ compilers support this feature now.

这篇关于C++17 并行算法是否已经实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&amp;()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6