Must I call atomic load/store explicitly?

前端 未结 2 1585
暖寄归人
暖寄归人 2020-12-25 09:51

C++11 introduced the std::atomic<> template library. The standard specifies the store() and load() operations to atomically set / get a varia

2条回答
  •  醉话见心
    2020-12-25 10:11

    Are assignment and access operations for non-reference types also atomic?

    Yes, they are. atomic::operator T and atomic::operator= are equivalent to atomic::load and atomic::store respectively. All the operators are implemented in the atomic class such that they will use atomic operations as you would expect.

    I'm not sure what you mean about "non-reference" types? Not sure how reference types are relevant here.

提交回复
热议问题