Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2004-12-19 07:50:26


----- Mensaje original -----
De: David Abrahams <dave_at_[hidden]>
Fecha: Domingo, Diciembre 19, 2004 2:10 am
Asunto: [boost] Re: boost::noncopyable

> Joaquin M Lopez Munoz wrote:
> > Dirk Gregorius <dirk <at> dirkgregorius.de> writes:
> >
>
> >> 1.) Are #1 and #2 equivalent?
> >
> > In a broad sense, yes. The problem is that many compilers
> > don't do EBO (empty base optiimzation) in the presence
> > of multiple inheritance, which might end up (in #2)
> > with sizeof(Implementation) being greater than strictly needed.
>
> Correct.
>
> >> 2.) When should I derive public and when private from
> boost::noncopyable?>
> > Given what I said, I think that deriving from boost::noncpyable
> > must be avoided if multiple inheritance is present and you
> > expct your class to be allocated on the stack.
>
> "Must be avoided" is a bit strong. One extra byte usually makes no
> difference for a class that will be allocated on the stack.

My fault: I meant "allocated on the heap".

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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