
From: "Robert Kawulak" <kawulak@student.agh.edu.pl>
here the problem begins - with some compilers inheriting from classes with no members doesn't change the sizeof of object, while with others it does. For instance:
struct e { };
struct f : public e { };
// A class inherited from empty base classes, with a char member struct g : public f { char c; };
// Same as g but not inherited struct h { char c; };
The sizeof for e, f, g and h is, respectively: with gcc & MSVC: 1, 1, 1, 1 DMC: 1, 1, 2, 1 Borland: 8, 8, 16, 1
You should assume a quality compiler that provides the EBO for the general case. For Borland, you can reduce the problem by conditionally inserting a char (not bool!) data member in the policies. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;