1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <boost/serialization/split_free.hpp>
class A
{
public:
vector<int> m_lstValues;
vector<int>::iterator m_whereIam;
int m_Position; // Just used to keep the iterator position for serialization
};
class A // Really needed?
template<class Archive>
void save(Archive & ar, A & a, const unsigned int version)
{
ar & a.m_lstValues;
a.m_Position = distance(m_lstValues, a.m_whereIam);
ar & a.m_Position;
}
class A // Really needed?
template<class Archive>
void load(Archive & ar, A & a, const unsigned int version)
{
ar & a.m_lstValues;
ar & a.m_Position;
a.m_whereIam = m_lstValues.begin() + a.m_Position;
}
BOOST_SERIALIZATION_SPLIT_FREE(A) |
Partager