Hello,
I have a base class:
class base {...};
and a derived class:
class derived : public base {...};
and a template class:
template <class T>
class ElementList {
vector* m_Elements;
...
friend class boost::serialization::access;
template<class Archive>
inline void serialize(Archive & ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(m_Elements);
}
}
Now i create a class:
class myclass : public ElementList<base> {
friend class boost::serialization::access;
template<class Archive>
inline void serialize(Archive & ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(ElementList);
}
}
I want to use boost::serialization on myclass
I create somwhere in my program several "derived" elements (which are
serialized at this point)
After, I put them in the m_Elements vector of myclass (hérited from
ElementList<base>). So, the "derived" are stored as "base" elements and the
problem is that they are serialized as "base" elements and not "derived"
elements.
Have you got an idea of how I can solve this issue?
Thanks by Advance
Emmanuel
--
View this message in context: http://www.nabble.com/boost%3A%3Aserialization-of-a-template-class-tp1910937...
Sent from the Boost - Users mailing list archive at Nabble.com.