
Here is my fix that attempts to account for the potential case of the compiler padding the structure size when the derived class adds members and/or virtual functions. I made the destructor of X and Y virtual and added an extra data-field that causes both X and Y to experience the same shift in padding and thus the only remaining difference is the virtual Base vs non-virtual Base. What do you think? Any potential problems / side effects? template<typename Base, typename Derived> struct is_virtual_base_of_impl<Base, Derived, mpl::true_> { struct X : Derived, virtual Base { X(); X(const X&); X& operator=(const X&); virtual ~X(); char x; }; struct Y : Derived { Y(); Y(const Y&); Y& operator=(const Y&); virtual ~Y(); char x; }; BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y))); }; On Feb 11, 2010, at 12:59 PM, John Maddock wrote:
cast the bool to an int, still does not work. It works for most cases, for example this works:
struct C : public A, public B { virtual test(); // }
struct C : public A, public B { virtual test(); float parameter; // DOESN"T WORK ANY MORE };
Which specific compiler version? I need something that I can reproduce here... John.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost