I have my own class containing the following data:
#include <boost/date_time/posix_time/time_serialize.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
using namespace boost::archive;
class Foo {
// [...]
unsigned int m_length;
std::vector<boost::posix_time::ptime> m_vecTimestamps;
std::vector<double> m_vecA;
std::vector<double> m_vecB;
std::vector<Point2d> m_vecPos;
Since I included the appropriate headers I am even able to serialize ptime:
// Still class Foo
private:
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive &ar, const unsigned int version) {
ar & m_length;
ar & m_vecTimestamps;
ar & m_vecA;
ar & m_vecB;
ar & m_vecPos; // ooops, error
}
Well, there is no approach to serialize Point2d since this class is delivered by a further third party library (contains simply 2 double values). So what are my options to write a wrapper which can be used within Foo::serialize? I would like to easily read and write that vector too. An easy example would be nice.
I tried to have a look at time_serialize.hpp but I do not understand how to write a similar approach for Point2d respectively other class types which can not be modified by myself?