Hello. I have template class. I want to serialize it. But I don't know how. template <class T> class AverDayVisTask : public DrawTask, public AverDayVisMathTask <T> { public: // some functions private: friend class boost::serialization::access; //! boost::serialize template <class Archive> void serialize(Archive& ar, const unsigned int /*version*/) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(DrawTask); ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(AverDayVisMathTask<T>); //<----- error } }; // class AverDayVisTask BOOST_CLASS_VERSION(AverDayVisTask<SphericalModel>, 1); BOOST_CLASS_VERSION(AverDayVisTask<SphericalNutModel>, 1); BOOST_CLASS_VERSION(AverDayVisTask<WGS84Model>, 1); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<SphericalModel>, boost::serialization::object_class_info); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<SphericalNutModel>, boost::serialization::object_class_info); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<WGS84Model>, boost::serialization::object_class_info); How fix my problem? -- Виктория Доможакова
On 2/24/16 1:29 AM, Виктория Доможакова wrote:
Hello. I have template class. I want to serialize it. But I don't know how.
template <class T> class AverDayVisTask : public DrawTask, public AverDayVisMathTask <T> { public: // some functions
private: friend class boost::serialization::access;
//! boost::serialize template <class Archive> void serialize(Archive& ar, const unsigned int /*version*/) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(DrawTask); ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(AverDayVisMathTask<T>); //<----- error }
}; // class AverDayVisTask
BOOST_CLASS_VERSION(AverDayVisTask<SphericalModel>, 1); BOOST_CLASS_VERSION(AverDayVisTask<SphericalNutModel>, 1); BOOST_CLASS_VERSION(AverDayVisTask<WGS84Model>, 1); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<SphericalModel>, boost::serialization::object_class_info); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<SphericalNutModel>, boost::serialization::object_class_info); BOOST_CLASS_IMPLEMENTATION(AverDayVisTask<WGS84Model>, boost::serialization::object_class_info);
How fix my problem?
try extra parenthesis
ar &
BOOST_SERIALIZATION_BASE_OBJECT_NVP((AverDayVisMathTask<T>));
participants (2)
-
Robert Ramey
-
Виктория Доможакова