Boost logo

Boost :

From: Chris Thomasson (cristom_at_[hidden])
Date: 2006-11-16 19:02:25

"Roland Schwarz" <roland.schwarz_at_[hidden]> wrote in message
> 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?

Humm. Good point...


> 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.

You could do that with meta programming. Would that be a viable option?

Boost list run by bdawes at, gregod at, cpdaniel at, john at