我想为原子< __ uint128_t>添加值但我有这个错误
erreur : no match for ‘operator+=’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::atomic<__int128 unsigned> > >::value_type {aka std::atomic<__int128 unsigned>}’ and ‘const value_type {aka const std::atomic<__int128 unsigned>}’)
niveau[ranka(pre)]+=etage_fils[i];
带
"typedef __uint128_t longuint;"
我的代码:
vector<atomic<longuint>> (vector<atomic<longuint>> const & etage_fils, int eta){
vector<atomic<longuint>> niveau(mahonian(n,eta-2));
int limite = mahonian(n, eta-1);
cilk_for (int i = 0; i < limite; ++i)
{
vector<Permut> parents = prec(unrank(eta-1, i));
for (Permut const & pre : parents)
{
niveau[ranka(pre)]+=etage_fils[i];
}
}
return niveau;
}
我试过
niveau[ranka(pre)].fetch_add(etage_fils[i];
但不能正常工作
任何帮助将不胜感激。谢谢:))