Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Problems with serializing a shared_ptr
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-11-16 22:37:06


On Mon, Nov 16, 2009 at 10:12 AM, Stefan Ulbrich <stevie157_at_[hidden]> wrote:
> Thanks for your answer, Robert. Mi compiler version is:
> gcc version 4.0.1 (Apple Inc. build 5465)
>
> The error occurs only in the load method of the class and the serialization
> routines for the matrix class are non-inversive (save seems to work).
>
> Do you have any idea what is causing this error?

I get a similar error on Visual Studio 2005 if the class in the shared
pointer is not virtual. Just add something like this to your class
and it magically works (I hate adding the overhead though...)

    private: virtual __dummy_virtual_to_get_boost_serialization_to_work(void){}

And no, I have no clue why Boost.Serialization requires a virtual
class to be able to compile through a shared pointer, it is quite
irritating, I had to make a wrapper class in one case...

I asked about this on the list before, but no one gave an answer why
or how to work around it.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net