1

次のコードを使用してクラスをシリアル化していますが、デバッグ バージョンでは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;
 } 
};

なぜそのエラーが発生するのかについて何か提案はありますか?

4

0 に答える 0