Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-10-22 08:28:07


----- Original Message -----
From: <brianjparker_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, October 20, 2001 9:17 PM
Subject: [boost] Re: Several useful utility classes uploaded

> --- In boost_at_y..., John Maddock <John_Maddock_at_c...> wrote:
> >
> > >alignment_traits class which is used to align stack-based or
> static
> > >memory
> >
> > See alignment_of in the type traits lib
> >
> >
> > - John Maddock
> > http://ourworld.compuserve.com/homepages/john_maddock/
>
> Hi,
>
> Yes, I am aware of alignment_of.
> The problem is that just knowing the required alignment is not useful
> without also having some form of standardised #pragma pack to
> actually effect the alignment requirements.
>
> By contrast, alignment_traits<T>::align_t, being a POD, is directly
> useable in a union to effect the alignment.
>
> For example, in the valunion class I use the following construct to
> align the embedded buffer
>
> union {
> typename alignment_traits<A>::align_t al1;
> typename alignment_traits<B>::align_t al2;
> typename alignment_traits<C>::align_t al3;
> char buffer[size_max];
> };
>
> I don't see how this buffer could be aligned with
> alignment_of<T>::value alone.
>
> I do think though that a good place to add the functionality of
> aligment_traits<T>::align_t to Boost is in boost::alignment_of i.e.
> boost::alignment_of could have an additional member align_t and
> alignment_traits would then be hidden in a detail namespace.
>
> ,Brian Parker
>
>
Please, take a look at: aligned_storage.hpp (and
aligned_storage_detail.hpp) in

http://groups.yahoo.com/group/boost/files/class%20optional

I believe this is exactly the same that you are presenting here.

Let me know what do you think.

Regards,

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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