
On Oct 30, 2007, at 9:18 AM, Hugh Hoover wrote:
most "interesting" difference so far: the save_construct_data is saving the reference through a const pointer, like:
boost::smart_ptr<B const> b_ptr = this->m_b; ar << boost::serialization::make_nvp("b_ptr", b_ptr);
while the load_construct_data unserializes with:
boost::smart_ptr<B> b_ptr; ar >> boost::serialization::make_nvp("b_ptr", b_ptr);
I'll try changing the save_construct_data to use a non-const pointer...
Well DAMN! I guess that makes sense - a pointer to const isn't the same as a pointer to non-const. At the time I (re)wrote the code it just made sense to me to use a const pointer... Actually - on looking at the older code, I was using a (c) pointer to const (like A const* a_ptr), in the save_construct_data and A * a_ptr in the load_construct_data. So, the change to using shared_ptr changed the behaviour of the serialization code... I'm not sure if shared_ptr should act exactly like a plain pointer in this case or not... In any case, thanks for the debugging tip :) I probably should have done that earlier.. Hugh Hoover Enumclaw Software And you probably already guessed that the code above is not quite right :) there's no "this" and it should be boost::shared_ptr<A>, not a "B" pointer.