Re: [Boost-users] BoostSerialization callinga customserialize method

Robert Ramey <ramey@rrsd.com> wrote:
Pooyan Dadvand wrote:
Can you please explain me more the idea of extradata structure? Consider that my extradata can be a double, ublas::vector, or even std::vector<weak_ptr<Element> > or any new type of variables. I have:
std::vector<std::pair<VariableData, extradata> > mData ... ar << mData;
and each element of vector can have a different type of data with different size or even have pointers. (It's a heterogeneous container)
The above will work as written.
Maybe what you want is:
template<class T> class mytype : std::vector<std::pair<VariableData, T> > { template<class Archive> void serialize(Archive &ar, const unsigned int version){ ar << boost::serialization::base_object(*this); } };
then you can
mytype<double> m_t ... ar << m_t
The possibilities are endless. This really isn't about the serialization library but about C++
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (1)
-
Elli Barasch