Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost serialization] non intrusive & derivated class
From: agrosjea (arnaud.grosjean_at_[hidden])
Date: 2010-06-23 08:41:30


agrosjea wrote:
>
> Hello.
>
> I'm currently trying to integrate the boost::serialization lib into my
> project and I encounter some problems :
>
> - With the non intrusive version I just cannot get my derivated class to
> serialize properly. I'm getting the "Invalid XML tag name" error (see
> http://codepad.org/EYHfWxqN http://codepad.org/EYHfWxqN for a short code
> sample )
>
> - Still with the non intrusive version, I really don't want to break my
> encapsulation with public attributes. So I wonder if I could use friend
> instead, but friend of what ?? (friend class boost::serialization::access
> doesnt seems to work)
>
> Thx for your help.
>

I found the problem in my code, the BOOST_SERIALIZATION_NVP macro doesnt
seems to support the derivated classes. so I used
boost::serialization::make_nvp(....) instead

it replaces
ar << BOOST_SERIALIZATION_NVP(boost::serialization::base_object<Father>(g));
by
ar << boost::serialization::make_nvp("son",
boost::serialization::base_object<Father>(g));

Hope this is gonna help someone...

-- 
View this message in context: http://old.nabble.com/-Boost-serialization--non-intrusive---derivated-class-tp28958229p28971287.html
Sent from the Boost - Users mailing list archive at Nabble.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