Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-11-15 06:30:19


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?

I would have expected that you will need the POD
requirements only for type T, not for atomic<T>.

>
> Atomic operation API must have static interface that operates on pointers to
> T as the destination of any operation. Usage is like:
>

So, why then wrap as a class at all?
Why not simply templated global functions?

What I think is more important than making atomic<T>
a POD, is making atomic<T> fail to compile if

1) sizeof(T) != sizeof(atomic_t)
2) alignment of T != required alignment of atomic_t

Where atomic_t is a type that is atomic on the given
platform/compiler.

Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk