0
我想在我的課堂裏得到兩個數組來使用boost序列化庫。我可以很好地保存數據,但出於某種原因,我無法加載它。我認爲這與ia >> *這是一致的。但我不知道如何解決它。任何人都可以將我指向正確的軌道?升壓序列化問題
class foo
{
private:
int tileType[512];
int tileSubType[512];
friend std::ostream & operator<<(std::ostream &os, const foo &gp);
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & tileType;
ar & tileSubType;
}
public:
foo();
void loadType(string data)
{
std::stringstream is(data);
boost::archive::text_iarchive ia(is);
ia >> *this;
}
string saveType()
{
stringstream ss(stringstream::in | stringstream::out);
boost::archive::text_oarchive oa(ss);
oa << this;
return ss.str().c_str();
}
};
編譯失敗?運行時失敗?你的問題是什麼? –