Assigning non-member functions such as atomic_store ()

I have read the documentation atomic_store

and I understand what it does. The question is, why is this function not a member? What does it provide that the member function does not? I mean member functions std::atomic

likestd::atomic::store()

There are also many such features here .

+3


source to share


1 answer


The goal of free functions is to provide an identical interface to atomistics in C and C ++. Atoms were developed in parallel between the C and C ++ committees, which is why they are so similar (<g>). It's up to the developers to make this work, but it's not difficult if you start with compatibility in mind. As a result, you can write the same code in C and C ++ if that's what you want, or , you can use C ++ member functions to sometimes get simpler and more powerful operations.



+1


source







All Articles