问题描述
在 我之前的问题 我已经问过了,我从 Microsoft 提供的 ppl.h 中触及了 parallel_for 主题.
但不久之后我意识到使用它会使他的应用程序不可移植(如果我是对的,它特定于 Microsoft(ppl.h 标头)).
在我看来,这破坏了 C++ 编程的一个非常重要的方面 - 可移植性,我只是不准备这样做.
所以我的问题是:
1. 我说使用 ppl 中的 parallel_for 会使您的代码不可移植吗(不可移植我的意思是说它不能由除 MS 编译器之外的其他编译器编译)
2. 我是否正确地说,如果在后期我想为我目前正在处理的应用程序提供 UI(在 Qt 中完成),在我的代码中使用 parallel_for 将是一个障碍,这意味着我要么将使用其他(便携式)替代方案替换 parallel_for ,否则我将无法在 Qt 中执行 UI 并在 VS 中执行核心?
3. ppl 的(便携式)替代品是什么?
In my previous question I've asked, I touched the parallel_for subject from ppl.h provided by Microsoft.
But shortly after I've realized that by using it one makes his application unportable (if I'm right it is specific to Microsoft (the ppl.h header)).
In my opinion this breaks very important aspect of programming in C++ - portability, and I'm just not prepare to do it.
So my questions are:
1. Am I right in saying that using parallel_for from ppl makes your code unportable (by unportable I mean that it cannot be compiled by other compiler than the one from MS)
2. Am I right in saying that if on later stage I want to provide UI (done in Qt) for the application I'm working on at the momment, using parallel_for in my code will be an obstruction which would mean that either I'll replace parallel_for with some other (portable) alternative or I won't be able to do UI in Qt and core in VS?
3. What are the (portable) alternatives to ppl?
推荐答案
您可能需要考虑英特尔的线程构建块.与 OpenMP 不同,TBB 实际上使用 C++,而不是简单地在 C++ 编译器下编译(即:作为可以编译为 C++ 的 C 库).它具有您在 PPL 中看到的许多内容,但它是跨平台的.
You may want to consider Intel's Thread Building Blocks. Unlike OpenMP, TBB actually uses C++, rather than simply compiling under a C++ compiler (ie: being a C library that can compile as C++). It has many of the things you see in PPL, but it is cross-platform.
还有 Boost.Thread,它是 C++(虽然不像 TBB 那样直接),而且它是跨平台的.
There is also Boost.Thread, which is C++ (though not quite as direct as TBB is), and it is cross-platform.
这篇关于ppl 的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)