std::atomic_fetch_xxx
(or, and, add, sub, xor)的一组自由函数,将一个std::atomic<T>*
命名的 obj作为输入:
template< class T >
T atomic_fetch_sub(std::atomic<T>* obj,
typename std::atomic<T>::difference_type arg ) noexcept;
问题:为什么将 std::atomic 类型作为指针而不是作为引用传入,例如:
T atomic_fetch_sub(std::atomic<T>& obj,
typename std::atomic<T>::difference_type arg ) noexcept;
有实际的理性/原因还是只是风格?