Home » U++ Library support » U++ Core » Array container does only serialize base classes
Array container does only serialize base classes [message #2814] |
Wed, 26 April 2006 09:38 |
hans
Messages: 44 Registered: March 2006 Location: Germany
|
Member |
|
|
Hi,
the Array container class does not recreate the derived classes when Serialize() for load is called, only the base classe.
Either it should recreate the derived class, which requires some kind of class factory, like MFC dyncreate. Or it should ASSERT on save if a derived class object is in the Array.
|
|
|
|
|
|
|
Re: Array container does only serialize base classes [message #2821 is a reply to message #2820] |
Wed, 26 April 2006 13:07 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
gprentice wrote on Wed, 26 April 2006 06:34 |
<speculating>
Not exactly sure what Array class does, as I haven't learnt NTL or concepts like "pick" yet (shame on me), but according to Array documentation, Array owns its contained objects, so maybe that means the class needs a virtual destructor anyway, otherwise the derived destructor is never called ??
Even if typeinfo failed to detect a derived type for some cases, it might help other cases, and a mechanism for disabling the runtime assert is probably easy to provide.
</speculating>
Graeme
|
I think you are right...
Just to make it clear, Array can and often is used in non-polymorphic situations too (e.g. for non-Moveable objects), then the virtual destructor really is not needed.
Mirek
|
|
|
Goto Forum:
Current Time: Thu Jun 13 05:14:31 CEST 2024
Total time taken to generate the page: 0.02523 seconds
|