boost serialization not working unless you have at least one virtual function in base
Hi all,
Does anybody know why this is the case?
Is there a way to make a class "polymorphic" without adding a dummy virtual
function?
Is this some "silly" optimization done by C++ compilers? Not generating
vtables?
It took me quite some time to figure this one out.
It is mentioned in the documentation (2 lines, easily missed).
http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/serialization.ht...
Maybe add a big huge WARNING? Also please mention this fact in the examples!
(like in demo.cpp?)
regards
M. Seiler
#include
AMDG Martin Seiler wrote:
Does anybody know why this is the case?
Is there a way to make a class "polymorphic" without adding a dummy virtual function?
No there isn't.
Is this some "silly" optimization done by C++ compilers? Not generating vtables?
The compiler only generates a vtable for polymorphic types. In Christ, Steven Watanabe
Hello,
On Mon, 09 Feb 2009 16:30:53 +0100, Steven Watanabe
AMDG
Martin Seiler wrote:
Does anybody know why this is the case?
Is there a way to make a class "polymorphic" without adding a dummy virtual function?
No there isn't.
Well, you could add a virtual destructor, which is not "dummy" at all :) and I hope it does not hurt you either Luca
Feel free to prepare and submit your suggested documentation improvement as a TRAK item. I'll consider it for inclusion. Robert Ramey It took me quite some time to figure this one out. It is mentioned in the documentation (2 lines, easily missed). http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/serialization.ht... Maybe add a big huge WARNING? Also please mention this fact in the examples! (like in demo.cpp?)
participants (4)
-
Luca Cappa
-
Martin Seiler
-
Robert Ramey
-
Steven Watanabe