|
Boost Users : |
From: Takeo (emlperrin_at_[hidden])
Date: 2008-08-22 17:39:00
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<T*>* 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-tp19109374p19109374.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net