我继续在我的程序中获得map/set iterator not dereferencable
断言。我很困惑,因为我很难理解为什么会发生这种情况。同时瞥见下面给出的堆栈跟踪。
msvcp100d.dll!std::_Debug_message() + 0x23 bytes
msvcp100d.dll!std::_Debug_message() + 0x16 bytes
> PROG.exe!std::_Tree_const_iterator<std::_Tree_val<std::_Tmap_traits<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> >,0> > >::operator*() Line 236 + 0x15 bytes C++
PROG.exe!boost::serialization::stl::save_collection<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & s) Line 63 + 0x11 bytes C++
PROG.exe!boost::serialization::save<boost::archive::text_oarchive,SomeClass,int,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > >(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, const unsigned int __formal) Line 41 + 0xd bytes C++
PROG.exe!boost::serialization::free_saver<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >::invoke(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, const unsigned int file_version) Line 45 + 0x18 bytes C++
PROG.exe!boost::serialization::split_free<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(boost::archive::text_oarchive & ar, std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, const unsigned int file_version) Line 74 + 0x11 bytes C++
PROG.exe!boost::serialization::serialize<boost::archive::text_oarchive,SomeClass,int,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > >(boost::archive::text_oarchive & ar, std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, const unsigned int file_version) Line 70 + 0x11 bytes C++
PROG.exe!boost::serialization::serialize_adl<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(boost::archive::text_oarchive & ar, std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, const unsigned int file_version) Line 128 + 0x18 bytes C++
PROG.exe!boost::archive::detail::oserializer<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >::save_object_data(boost::archive::detail::basic_oarchive & ar, const void * x) Line 152 + 0x31 bytes C++
PROG.exe!boost::archive::detail::basic_oarchive_impl::save_object(boost::archive::detail::basic_oarchive & ar, const void * t, const boost::archive::detail::basic_oserializer & bos) Line 275 C++
PROG.exe!boost::archive::detail::basic_oarchive::save_object(const void * x, const boost::archive::detail::basic_oserializer & bos) Line 424 C++
PROG.exe!boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::save_standard::invoke<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t) Line 259 C++
PROG.exe!boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::invoke<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t) Line 308 + 0xd bytes C++
PROG.exe!boost::archive::save<boost::archive::text_oarchive,std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > const >(boost::archive::text_oarchive & ar, const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t) Line 525 + 0xd bytes C++
PROG.exe!boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::save_override<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > const >(const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, int __formal) Line 69 + 0x15 bytes C++
PROG.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::save_override<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > const >(const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t, int __formal) Line 81 C++
PROG.exe!boost::archive::detail::interface_oarchive<boost::archive::text_oarchive>::operator<<<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > const >(const std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t) Line 64 C++
PROG.exe!boost::archive::detail::interface_oarchive<boost::archive::text_oarchive>::operator&<std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > >(std::map<int,SomeClass,std::less<int>,std::allocator<std::pair<int const ,SomeClass> > > & t) Line 75 C++
PROG.exe!---::serialize<boost::archive::text_oarchive>(boost::archive::text_oarchive & ar, const unsigned int version) Line 42 C++
PROG.exe!boost::serialization::access::serialize<boost::archive::text_oarchive,--->(boost::archive::text_oarchive & ar, --- & t, const unsigned int file_version) Line 119 C++
PROG.exe!boost::serialization::serialize<boost::archive::text_oarchive,--->(boost::archive::text_oarchive & ar, --- & t, const unsigned int file_version) Line 69 + 0x11 bytes C++
PROG.exe!boost::serialization::serialize_adl<boost::archive::text_oarchive,--->(boost::archive::text_oarchive & ar, --- & t, const unsigned int file_version) Line 128 + 0x18 bytes C++
PROG.exe!boost::archive::detail::oserializer<boost::archive::text_oarchive,--->::save_object_data(boost::archive::detail::basic_oarchive & ar, const void * x) Line 152 + 0x31 bytes C++
PROG.exe!boost::archive::detail::basic_oarchive_impl::save_object(boost::archive::detail::basic_oarchive & ar, const void * t, const boost::archive::detail::basic_oserializer & bos) Line 275 C++
PROG.exe!boost::archive::detail::basic_oarchive::save_object(const void * x, const boost::archive::detail::basic_oserializer & bos) Line 424 C++
PROG.exe!boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::save_standard::invoke<--->(boost::archive::text_oarchive & ar, const --- & t) Line 259 C++
PROG.exe!boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::invoke<--->(boost::archive::text_oarchive & ar, const --- & t) Line 308 + 0xd bytes C++
PROG.exe!boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive>::invoke<--->(boost::archive::text_oarchive & ar, --- & t) Line 314 + 0xd bytes C++
PROG.exe!boost::archive::save<boost::archive::text_oarchive,--->(boost::archive::text_oarchive & ar, --- & t) Line 525 + 0xd bytes C++
PROG.exe!boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::save_override<--->(--- & t, int __formal) Line 69 + 0x15 bytes C++
PROG.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::save_override<--->(--- & t, int __formal) Line 81 C++
PROG.exe!boost::archive::detail::interface_oarchive<boost::archive::text_oarchive>::operator<<<--->(--- & t) Line 64 C++
PROG.exe!DipqCon::Dispatach_Ecl(--- & hf, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & symbol) Line 123 C++
我怀疑这可能是由于提升序列化造成的。 我按如下顺序排列:
void DipqCon::Dispatach_Ecl(SomeObject &hf)
{
std::stringstream ss;
boost::archive::text_oarchive oa(ss);
oa << hf;
std::string serialized = ss.str();
DoSomething(serialized);
}
我想知道获取(如果有任何获取map / set iterator而不是dereferencable)断言的机会在这里。