Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2004-05-26 13:26:01


Hi Pavel,

>> Making a transition between two inner states is the equivalent of
>> destructing the derived class portion of the object but leaving the
>> base class portion intact and then constructing a different derived
>> class object on top of
> the
>> base class portion. This is of course not possible in C++ ....

> It is sort of possible using placement constructors and destructors:
> - allocate enough of memory to hold largest derived object
> - construct derived object 1
> - destruct derived object 1 but keep its base class data
> - construct derived object 2 on the same place and 'reuse' base class
> data

Hmm, how do you avoid that the base class constructor is called when you
construct the derived object 2? Not that I have ever used placement new, but
I can't recall having seen the possibility of not calling the base class
constructor when you call a derived class constructor.

Regards,

Andreas


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