|
Boost Users : |
From: Oliver Mutz (mutz_at_[hidden])
Date: 2006-08-28 02:26:00
Hi all,
has anyone ever used the versioning mechanism of the serialization library
together with template classes?
What I want to do is something like:
class TemplateA
{
public:
TemplateA();
public:
...
//Serialization stuff
private:
friend class boost::serialization::access;
template<class Archive>
void save(Archive & ar, const unsigned int /*version*/) const
{
ar & boost::serialization::make_nvp("HighValue",m_high)
& boost::serialization::make_nvp("NewData",m_newData);
}
template<class Archive>
void load(Archive & ar, const unsigned int version)
{
ar & boost::serialization::make_nvp("HighValue",m_high);
if (version > 0)
{
ar & boost::serialization::make_nvp("NewData",m_newData);
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
private:
T m_high;
T m_newData;
}; // class TemplateA
BOOST_CLASS_VERSION(TemplateA, 1);
The above won't compile for sure, but I'm looking for a way to use the
versioning without having
to specialize it for each type T which I'm going to use this class with.
Best regards
Oliver Mutz
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