id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 1942,Pointers to elements in a std::map are not serilaized correctly,bernhard.maeder@…,Robert Ramey,"When serializing a std::map and some pointers that are referencing onto elements of that map, those pointers are not loaded correctly. Here's the code: {{{ #include #include #include #include struct dummy { template void serialize(Archive & ar, const unsigned int version) { } }; struct map_ref_test { std::map m; dummy * ref; template void serialize(Archive & ar, const unsigned int version) { ar & m; ar & ref; } }; int main() { std::ostringstream os; map_ref_test m; m.m[0] = dummy(); m.m[1] = dummy(); m.m[2] = dummy(); m.ref = &(m.m[1]); // serialize boost::archive::text_oarchive out(os); out << const_cast(m); // De-serialize map_ref_test m2; std::string ser = os.str(); std::istringstream is(ser); boost::archive::text_iarchive in(is); in >> m2; std::cout << ""0: "" << &m.m[0] << std::endl; std::cout << ""1: "" << &m.m[1] << std::endl; std::cout << ""2: "" << &m.m[2] << std::endl; std::cout << ""ref: "" << m.ref << std::endl << std::endl; std::cout << ""0: "" << &m2.m[0] << std::endl; std::cout << ""1: "" << &m2.m[1] << std::endl; std::cout << ""2: "" << &m2.m[2] << std::endl; std::cout << ""ref: "" << m2.ref << std::endl; } }}} This creates the following output: {{{ 0: 0x805bfc4 1: 0x805bfe4 2: 0x805c004 ref: 0x805bfe4 0: 0x805ca04 1: 0x805ca24 2: 0x805ca44 ref: 0xbfacad5c }}} I'd expect the last line to read: {{{ ref: 0x805ca24 }}} The code works for std::vectors, so I'd assume it should work for maps also.",Bugs,closed,To Be Determined,serialization,Boost 1.35.0,Problem,wontfix,,