Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-09-18 13:19:33


>----- Original Message -----
>From: Daniel Frey <daniel.frey_at_[hidden]>
>To: <boost_at_[hidden]>
>Sent: Tuesday, September 18, 2001 1:24 PM
>Subject: Re: [boost] Re: noncopyable as a virtual base class?
>

> [SNIP]
>
> Although I wonder what "overhead" will be
>introduced by 'virtual noncopyable' by a reasonable clever compiler...
>
>Regards, Daniel

However clever a compiler might be, a virtual base class *requires* the
object layout to be split in at least two parts, which in turn is always (or
at least nearly always) implemented as a 'pointer to the base class part' as
a hidden data member. This has to be setup upon object construction, so the
class constructor adds as a minimum defining this pointer to base.
Additionally, some compilers might refuse to apply some
optimizations -particularly inlining- in expressions involving
construction/destruction of classes with virtual bases: Since the compiler
must call the virtual base class ctor and dtor through the pointer to base,
this can prevent, for example, full inlining (even if the virtual base
ctor/dtor is empty).

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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