Folks ,

I feel a lack of understanding what actually track_always trait does. I expect that boost does not allow me to save/load twice object with the same address?

 
But it reports BOOST_STATIC_ASSERT even in following case:

 
Question 1

 

Class A

{

// serialization support

};

 

BOOST_CLASS_TRACKING (A, track_always)

BOOST_CLASS_EXPORT( A)

 …

A* a = new A;

oa << a ;




 assert in oserializer.hpp

 // if your program traps here, it indicates taht your doing one of the following:

// a) serializing an object of a type marked "track_never" through a pointer.

// b) saving an non-const object of a type not markd "track_never)

// Either of these conditions may be an indicator of an error usage of the

    // serialization library and should be double checked.  See documentation on

    // object tracking.

 


Qurstion 2

Above code with using of  xml_oarchive compliles and works:

oa << BOOST_SERIALIZATION_NVP(a);

oa << BOOST_SERIALIZATION_NVP(a);

 

I expect that it should raise above BOOST_STATIC_ASSERT because I trying to store the same object twice?

  

Question 3

 
Also I can't understand how track_always serialization trait works in case of
Diamond inheritance

 

Quataion from documentation

"In a diamond hesitance structure with a virtual base class, object tracking will prevent redundant save/load invocations"

How boost knows that this is virtual base class and prevents redundant save/load invocations?

 

Please help me to find the way to understanding of object tracking trait :)

Thank you