我最近偶然发现了一篇关于Pollard的Rho算法并行化的论文,并且根据我的具体应用,除了我没有达到所需的数学水平之外,我想知道这种特殊的并行化方法是否有助于我的特定情况.
我试图找到两个因素 - 半数 - 一个非常大的数字.基于我对本文的理解很少,我的假设是,这种并行化在具有许多较小因子的数字上运行良好,而不是在两个非常大的因素上.
这是真的?我应该使用此并行化还是使用其他东西?我是否应该使用Pollard的Rho,还是更好地并行化不同的分解算法?
采取以下代码段:
#include <vector>
std::vector<int> good;
//illegal, because std::allocator<const T> is ill-formed
std::vector<const int> bad;
//fails to compile under MSVS 2017
std::vector<const int, my_custom_allocator> X;
Run Code Online (Sandbox Code Playgroud)
为什么X无法编译?MSVS 2017展示
错误C2338(失败的静态断言):由于分配程序的格式不正确,因此C ++标准禁止使用const元素的容器。
据我了解,这不一定是正确的。
According to 20.5.3.5 [allocator.requirements] (and many SO questions), an allocator of a const T is ill-formed - but as I understand it, it is also possible to define an allocator that only works with a single type (meaning, a non-templated allocator). This avoids, albeit in a slightly pedantic way, the …