I have have been doing some math with std::atomic_llong numbers lately and I have recently gotten to this error.
error: use of deleted function ‘std::atomic<long long int>& std::atomic<long long int>::operator=(const std::atomic<long long int>&)’
202 | currquadtickpos = prevquadtickpos;
| ^~~~~~~~~~~~~~~
In file included from /home/$USER/position.cpp:21:
/usr/include/c++/9/atomic:848:15: note: declared here
848 | atomic& operator=(const atomic&) = delete;
| ^~~~~~~~
Basically, I was trying to take an atomic value and assign it to another atomic value, thus making both atomic variables equal. For some reason, however, this is not allowed.
Why is atomic assignment not allowed?
And then, given the answer to the question above, is there another way to do atomic number assignment?