_The Empty Member C++ Optimization_ by Nathan Myers Listing One template class allocator { // an empty class static T* allocate(size_t n) { return (T*) ::operator new(n * sizeof T); } . . . }; Listing Two template > class list { Alloc alloc_; struct Node { . . . }; Node* head_; public: explicit list(Alloc const& a = Alloc()) : alloc_(a) { . . . } . . . }; Listing Three struct Bar { }; struct Foo { struct Bar a[2]; struct Bar b; }; Foo f; Listing Four template > class list : private Alloc { struct Node { . . . }; Node* head_; public: explicit list(Alloc const& a = Alloc()) : Alloc(a) { . . . } . . . }; Listing Five template > class list { struct Node { . . . }; struct P : public Alloc { P(Alloc const& a) : Alloc(a), p(0) { } Node* p; }; P head_; public: explicit list(Alloc const& a = Alloc()) : head_(a) { . . . } . . . }; Listing Six template struct BaseOpt : Base { Member m; BaseOpt(Base const& b, Member const& mem) : Base(b), m(mem) { } }; Listing Seven template > class list { struct Node { . . . }; BaseOpt head_; public: explicit list(Alloc const& a = Alloc()) : head_(a,0) { . . . } . . . };