From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-01 09:06:56
----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
> On Thursday 28 February 2002 05:27 pm, you wrote:
> > > I did something like that at one point, and it was painful to
> > > like Brian Parker's version because it is so much simpler than any
> > > typelist-based approach.
> > Can you give the quick one-sentence summary of what he's doing?
> The type to align against is a union, where the type 'X' of each member is
> type 'U' if sizeof(U) <= sizeof(type_we_want_to_make_storage_for) and char
So if the type I'm storing is char, it will over-align, yes?
In my application it's much more important to actually produce an
appropriate alignment than that the size is minimal, but that won't be true
for many. Since this is all a crapshoot anyway and the language gives no
guarantees of success it seems like Brian's algorithm ought at least to
check that sizeof(U) <= alignment_of(type_we_want_to_make_storage_for).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk