Boost Serialisation problem

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Boost Serialisation problem

This post has NOT been accepted by the mailing list yet.
Hi. if have an problem with the Boost serialisation, i dont understand.
Somehow i cant read files that are made of classes with multiple classes.

if i decrease the looplength everything works, but if the loop reaches one exact point, (i < 26) it crashes when i want to read the file. any ideas?

        _IndexCluster z(0, 0, 0);

        for(int i = 0; i < 26; i++) {   // change the loop length here
                _IndexCluster a(0, 0, 0);

        ofstream treeout("bla.Arv");
                boost::archive::binary_oarchive oa(treeout);
                oa << z;

        _IndexCluster n;
        std::ifstream treein("bla.Arv");
                boost::archive::binary_iarchive ia(treein);
        ia >> n; // crash!

The class _index Cluster is very simple:

class _IndexCluster {
                 _IndexCluster(_u32 key, _u32 byteOffset, _u32 size);

                void insert (_IndexCluster obj);

                friend class boost::serialization::access;
                template<class Archive>
                void serialize(Archive& ar, _u16 version) {
                        ar & m_Key;
                        ar & m_byteOffset;
                        ar & m_Size;
                        ar & m_subCluster;

                _u32 m_Key;
                _u32 m_byteOffset;
                _u32 m_Size;
                vector<_IndexCluster> m_subCluster;