
26 Apr
2012
26 Apr
'12
8:33 p.m.
On Thursday 26 April 2012 22:26:24 Mathias Gaunard wrote:
On 26/04/12 22:08, Jeffrey Lee Hellrung, Jr. wrote:
Doesn't the same thing happen in boost::optional and boost::variant?
Yes, their code is arguably ill-formed, but I'm sure some people claim otherwise.
AFAIK the only way to implement this in a standard conforming way is with C++11 unrestricted unions. Alternatively, all compilers that implement strict aliasing provide attributes to allow aliasing locally.
I think, std::aligned_storage is intended for this.