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 22:04:18


Benoit Gagnon wrote:
> On Mar 20, 2:13 pm, Sohail Somani <soh..._at_[hidden]> wrote:
>> Benoit Gagnon wrote:
>>>> 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)
>
> That did it, thank you!

Great!

IMHO, with Boost Serialization, more than others, you really do need to
read the *whole* documentation before you write code. It will pay
dividends. I'm pretty sure this exact case is covered somewhere in the docs.

-- 
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