[Boost-bugs] [Boost C++ Libraries] #4373: object tracking not working when pointer is serialized before class member

Subject: [Boost-bugs] [Boost C++ Libraries] #4373: object tracking not working when pointer is serialized before class member
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-24 13:10:01


#4373: object tracking not working when pointer is serialized before class member
--------------------------+-------------------------------------------------
 Reporter: anonymous | Owner: ramey
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: serialization
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 I'm not sure if this is a bug or a limitation of Boost.Serialization.
 I haven't found anything in the documentation saying that this limitation
 exists though.
 it's certainly unexpected if you don't think about serilization internals:

 struct B{
   //Serializable
 };

 struct A{
   B *bptr;

   B b;

   template<class Archive>

   void serialize(Archive &ar,unsigned int){

     ar & bptr; //error

     ar & b;

   }

 };

 if bptr is pointing to b, the object can not be loaded correctly. I'm not
 sure what actually happens, I guess there is a duplicate created, but bptr
 isnt equal to &b after serialization, as it was before serialization.

 b must be serialized before bptr for this to work.

 testcase attached.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4373>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC