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