
22 Sep
2010
22 Sep
'10
10:20 a.m.
On 17/09/2010 16:11, dherring@ll.mit.edu wrote:
The "standard" workaround is to allocate your own memory and use manual type casting. Boost::aligned_storage can be used to maintain proper alignment, but it cannot be placed inside a union due to the default ctor, dtor, and noncopyable functions. Thus I am forced to use part of boost::detail.
That approach is fundamentally broken as this is not allowed by the strict aliasing rules of C++. Every other utility that uses it, such as variant and optional, are broken too; but they've got no other choice for their implementation, unfortunately, at least until C++0x.