Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I put the empty base class?

Does the order in which I list the base classes matter when one of them is empty and the other one is not?

class Foo : normal_class, empty_class { ... };

class Foo : empty_class, normal_class { ... };

Does the order affect the compiler's ability to apply the empty base class optimization?

like image 355
fredoverflow Avatar asked Sep 14 '11 12:09

fredoverflow


1 Answers

I don't think it matters - although I tend to try to put an empty base first anyway.

There's an interesting note on multiple empty bases on the boost site: http://www.boost.org/doc/libs/1_38_0/libs/utility/operators.htm#old_lib_note

like image 53
Alan Stokes Avatar answered Oct 20 '22 18:10

Alan Stokes