
On 29/05/2010 0:24, Ilya Sokolov wrote:
Ion Gaztañaga wrote:
Adding a base class is not something I like because in some C++03 (Msvc I think, empty base classes are not optimized with multiple inheritance),
IIRC, compilers don't do SBO if the same class is used as a base multiple times. However, movable<> will be instantiated with different types most of the time.
Taken from: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/6502c2d3-7c06... #include <cstdio> class E1 { public: void ReportE1() { std::printf("In E1, this is %p\n", this); } }; class E2 { public: void ReportE2() { std::printf("In E2, this is %p\n", this); } }; class E3 { public: void ReportE3() { std::printf("In E3, this is %p\n", this); } }; class D: public E1, public E2, public E3 { }; int main() { D d; d.ReportE1(); d.ReportE2(); d.ReportE3(); } Reports the same this pointer values if compiled using G++; However, when I compile it using visual C++ 2010 express, the values reported increment by 1, say 10000,10001,10002. Best, Ion