
11 Aug
2005
11 Aug
'05
12:28 p.m.
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