Re: [boost] Re: boost::noncopyable

----- Mensaje original ----- De: David Abrahams <dave@boost-consulting.com> 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

JOAQUIN LOPEZ MU?Z wrote:
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".
But the same argument applies. One extra byte usually makes no difference. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
David Abrahams
-
JOAQUIN LOPEZ MU?Z