
"Roland Schwarz" <roland.schwarz@chello.at> wrote in message news:455AFA4B.7010605@chello.at...
Chris Thomasson wrote:
Here is how I define rules for my atomic<T>:
Can't use any constructors, destructors, base classes, virtual functions, or anything else that violates POD requirements.
Can't use any operators
Hmm, what is your rationale for this choice?
What are the memory barrier characteristics' of all the operators that make store/load to/from the user provided T POD type? I would assume they are naked... How would you define them?
I would have expected that you will need the POD requirements only for type T, not for atomic<T>.
Template function API sounds better than atomic<T> class that holds a member of type T. Define a rule that states that T must be a POD, and must be a type that can be atomically modified by the target architecture. The latter can be handled with arch-specific template metaprogramming, the former can be handled with an undefined behavior clause.