this good answer says:
volatileis completely unnecessary when used withstd::atomic.
However, std::atomic_fecth_sub provides an overloaded function:
template<class T>
T atomic_fetch_sub(volatile std::atomic<T>* obj,
typename std::atomic<T>::difference_type arg ) noexcept;
My question is:
If volatile is completely unnecessary for std::atomic, why does the C++ standard provide an overloaded function for it?
Aucun commentaire:
Enregistrer un commentaire