0
對於boost :: serialize我試圖用自己的序列化函數定義一個自定義類,類似於http://www.boost.org/doc/libs/1_53_0/libs/serialization/doc/tutorial.html#simplecase但是,該程序只是段錯誤。爲什麼?boost :: serialize段錯誤
class Test {
public:
unsigned short testid;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & testid;
}
};
int main() {
Test mytest = {100};
std::ofstream ofsx("test.tmp");
boost::archive::binary_oarchive oax(ofsx);
oax << mytest;
cout << "Exported";
exit(1);
}
我也試過非侵入式的版本,結果相同。
我錯過了什麼嗎?
哪一行導致段錯誤?堆棧跟蹤的樣子是什麼? – 2013-02-13 20:39:38
想通了,謝謝! – Nils 2013-02-13 21:59:32