Boost logo

Boost :

From: Joao Abecasis (jpabecasis_at_[hidden])
Date: 2005-08-11 07:28:14


christopher diggins wrote:
> Anyway it turns out we can guarantee alignment by simply using a char
> buffer. According to 3.9/2 the following automatically has no alignment
> problems:
>
> template<int buffer_size>
> struct any {
> char buffer[buffer_size];

Here buffer will only meet the alignment requirements of char. IIUC,
char[buffer_size] generates properly aligned storage for something of
size buffer_size only when used in a new expression:

    char * buffer = new char[buffer_size];

Anyway, perhaps you could into boost::aligned_storage for your purposes.

Regards,

João Abecasis


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