i have situation like this:
class IData
{
virtual void get() = 0;
virtual void set() = 0;
}
BOOST_ASSUME_IS_ABSTRACT(IData)
BOOST_EXPORT_CLASS(IData)
template<typename T>
class ConcreteData : public IData
{
public:
protected:
template<typename Archive>
void serialize(Archive& ar, const unsigned version)
{
ar & data;
}
private:
std::vector<T> mData;
}
BOOST_EXPORT_CLASS(ConcreteData<float>)
BOOST_EXPORT_CLASS(ConcreteData<int>)
BOOST_EXPORT_CLASS(ConcreteData<double>)
i want to serialize and deserialize "IData" instances via boost serialization but it seems not working. Has anyone done this before or do you have any suggestions.by the way i am usin VS 2005.
Try using BOOST_CLASS_EXPORT_GUID
instead:
BOOST_CLASS_EXPORT_GUID(ConcreteData<float>, "ConcreteData<float>")
BOOST_CLASS_EXPORT_GUID(ConcreteData<int>, "ConcreteData<int>")
In case your class lives in a namespace, don't forget to add the namespace:
BOOST_CLASS_EXPORT_GUID(NameSpace::ConcreteData<float>, "NameSpace::ConcreteData<float>")
BOOST_CLASS_EXPORT_GUID(NameSpace::ConcreteData<int>, "NameSpace::ConcreteData<int>")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.