
On 09/22/10 05:20, Mathias Gaunard wrote: [snip]
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.
How would C++0x avoid the problem? A google of "strict aliasing rule" turned up: http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-al... which says: Strict aliasing is an assumption, made by the C (or C++) compiler, that dereferencing pointers to objects of different types will never refer to the same memory location (i.e. alias each other.) Could you point to the variant code violating this rule? TIA. -Larry