Boost logo

Boost :

Subject: Re: [boost] [Operators] empty_base should be untemplated?
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-07-20 12:02:53


on Thu Jul 18 2013, Andrew Ho <helloworld922-AT-gmail.com> wrote:

> I've noticed about the empty_base class is that it's templated with type T,
> and I don't think it should be.
>
> Fyi, the empty_base class is there to turn multiple inheritance into a single
> inheritance chain (due to compiler deficiencies/object size bloat on at least
> Visual Studio).
>
> I don't see why this empty_base should be templated, and it would be better
> suited if it wasn't since all I can think it does is make the compiler work
> harder. Does anyone know why it was templated to begin with? Additionally, are
> we safe to change empty_base to be not use templates?

It's templated so that multiple inheritance doesn't kill the empty base
optimization.

-- 
Dave Abrahams

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk