Boost C++ Libraries: Ticket #4373: object tracking not working when pointer is serialized before class member https://svn.boost.org/trac10/ticket/4373 <p> 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: </p> <p> struct B{ </p> <blockquote> <p> <em>Serializable </em></p> </blockquote> <p> }; </p> <p> struct A{ </p> <blockquote> <p> B *bptr; </p> </blockquote> <blockquote> <p> B b; </p> </blockquote> <blockquote> <p> template&lt;class Archive&gt; </p> </blockquote> <blockquote> <p> void serialize(Archive &amp;ar,unsigned int){ </p> </blockquote> <blockquote> <blockquote> <p> ar &amp; bptr; <em>error </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> ar &amp; b; </p> </blockquote> </blockquote> <blockquote> <p> } </p> </blockquote> <p> }; </p> <p> 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 &amp;b after serialization, as it was before serialization. </p> <p> b must be serialized before bptr for this to work. </p> <p> testcase attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4373 Trac 1.4.3 anonymous Thu, 24 Jun 2010 13:10:35 GMT attachment set https://svn.boost.org/trac10/ticket/4373 https://svn.boost.org/trac10/ticket/4373 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">testcase.cpp</span> </li> </ul> Ticket anonymous Thu, 24 Jun 2010 13:19:59 GMT <link>https://svn.boost.org/trac10/ticket/4373#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4373#comment:1</guid> <description> <p> test </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 26 Jun 2010 21:04:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4373#comment:2 https://svn.boost.org/trac10/ticket/4373#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> my mistake. archive_exception is thrown on serialization. </p> Ticket