From: Bill Wade (bill.wade_at_[hidden])
Date: 2000-08-24 08:31:40


> From: David Abrahams [mailto:abrahams_at_[hidden]]

> How about this, for determining the alignment requirements of any POD:
>
> template <class PodT>
> class alignment_of
> {
> struct align {
> char misalign;
> PodT x;
> };
> public:
> const std::size_t value = offsetof(align, x);
> };

Very good. That looks right to me. You'll certainly get a valid answer,
and only an obnoxious compiler would give you something other than the
smallest valid answer.