Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization of a std::vector< boost::shared_ptr< A> > throws unregistered_class exception
From: Sohail Somani (sohail_at_[hidden])
Date: 2009-03-20 17:13:38


Benoit Gagnon wrote:
> On Mar 19, 10:26 am, Benoit Gagnon <b.gag..._at_[hidden]> wrote:
>> On Mar 19, 9:58 am, "Robert Ramey" <ra..._at_[hidden]> wrote:
>>
>>> Depending on which version of boost you're using. You may have
>>> to include a special macro - look into serialization/shared_ptr.hpp
>>> at the end.
>>> Robert Ramey
>> I'm using Boost 1.34.1.
>> The only macro I see in serialization/shared_ptr.hpp is
>> BOOST_SERIALIZATION_SHARED_PTR.
>>
>> Am I missing something?
>>
>
> I still haven't figured this out, if anyone has clues...
> Should I make a wrapper class around the std::vector and implement
> serialization for it?

Do you have BOOST_CLASS_EXPORT for each class that you are serializing
by base class pointer? For example, Hospital. You should have something
like:

#include <boost/serialization/export.hpp>

class Hospital ...;

BOOST_CLASS_EXPORT(Hospital)

-- 
Sohail Somani
http://uint32t.blogspot.com

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