On 11/06/10 07:33, alfC wrote: [snip]
On Nov 6, 5:17 am, Christopher Schmidt
wrote:
[snip]
Nothing is stored in those 4 additional bytes. As I said above one additional byte is added by the compiler to the 3*sizeof(double) bytes so one is able to distinguish between the two instances of a common base class (fusion::sequence_root) of the vector (fusion::vector
) and the internal vector data storage (fusion::vector3 ). To get size and alignment right this one byte actually emits a 4-byte overhead on your compiler. Isn't something called Empty Base Optimization that helps with this problem? (not sure if it applies here).
So there is no way around it? (unless the internal design is changed?) [snip] Not if the compiler conforms to the standard, AFAICT. However, apparently, according to the Christopher's earlier post:
http://article.gmane.org/gmane.comp.lib.boost.user/63553 MSVC 2010 (x86) believes avoiding this restriction has some advantage. There is a link in this post: http://groups.google.com/group/comp.lang.c++/msg/ab0c802f7b5e9072 to comp.lang.c++ which maybe explains more. That post also has a code attachment illustrating that EBO doesn't always work as one might expect(see the struct empties_inherit). The code attachment also shows a workaround using: https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/boost/co... HTH. -Larry