I am new to atomic in C++ and trying to make a tuple from atomic objects. I am getting a compile time error and I do not understand why. How can I resolve the error?
Created this test program
int main()
{
std::atomic<double> a1{0};
std::atomic<double> a2{0};
std::atomic<double> a3{0};
// Parallel processing
ParallelFor(...) {
// update atomic variables.
}
std::make_tuple(a1,a2,a3);
return 0;
}
Compile time error:
In instantiation of 'constexpr std::tuple<typename std::__decay_and_strip<_Elements>::__type ...> std::make_tuple(_Elements&& ...) [with _Elements = {std::atomic<double>&, std::atomic<double>&, std::atomic<double>&}]':
progatomic.cpp:17:26: required from here
error: no matching function for call to 'std::tuple<std::atomic<double>, std::atomic<double>, std::atomic<double> >::tuple(std::atomic<double>&, std::atomic<double>&, std::atomic<double>&)'
return __result_type(std::forward<_Elements>(__args)...);
Thanks