我正在使用以下代码序列化一个类,在调试版本中我偶尔会得到map/set iterator not dereferencable
断言。这是我的代码
void SomeMethod(MyCollection &hf)
{
boost::archive::text_oarchive oa(ss);
oa << hf;
std::string serialized = ss.str();
....
....
//do something with the string...
}
我试图序列化的对象如下
class MyCollection
{
private:
typedef std::map<int,ActCollection> Ctype;
Ctype Accts
//Setters and getters not shown
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive &ar, const unsigned int version)
{
ar & Accts;
}
};
关于为什么我可能会收到该错误的任何建议?