Boost logo

Boost :

Subject: Re: [boost] [forward_declare] Interest Inquiry toward Faster Compile Times
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-08-02 13:40:19

On Thursday 02 August 2012 01:28:12 Daniel Larimer wrote:
> Suppose I did this:
> template<typename T, unsigned int S, typename A = double>
> struct fwd {
> ...
> union {
> A _force_align;
> char s[S];
> } _store;
> };
> Now users of the API could 'align to' any type they wish, defaulting to
> double which should be sufficient for most cases. Anyone using forward
> declarations like this is probably doing so for types that are at least 8
> bytes in size and probably not for types leveraging SSE vectors.

I think, specifying an integral alignment would be better for this very
reason. However, you will probably have to resort to compiler-specific
directives to achieve alignments greater than ones for the standard types.

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