Can you give an example of the expected XML output and the actual XML output?

What is MyColorsObject?

Can you provide a complete minimal example?

--Raoul

Op 3 feb. 2017 om 17:27 heeft Robert P <robert.pel.83@gmail.com> het volgende geschreven:

In my serialize function I am exporting a class which is a template wrapper around std:vector.

template <typename E>
class MyArray
{
public:
    vector<E> array;
    ...

    template <typename Archive>
    void MyArray::serialize(Archive & ar, const unsigned int version)
    {
        ar & BOOST_SERIALIZATION_NVP(array);
    }
   
}

When I add unique class instance variables to this array and then serialize it to XML...
...
MyArray<Color> colorsArray;

Color a;
a.name = "one";
colorsArray.add(a);

Color b;
b.name = "two";
colorsArray.add(b);
...


template <typename Archive>
void MyColorsObject::serialize(Archive & ar, const unsigned int version)
{
    ar & BOOST_SERIALIZATION_NVP(colorsArray);
}

Sometimes the XML comes out using object_id_reference instead of the unique values, and this then gets improperly unserialized with incorrect values, i.e. both colors will have "one" as the name.

I was able to disable object tracking and it works now, but I don't think it should be doing object reference tracking on instance variables.  Is it because of the template wrapper around vector?
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users