
AMDG elizabeta petreska wrote:
I just want to say that I managed to solve this problem without creating a temporary , thanks to this thread : http://old.nabble.com/(de)serializing-map%3Cconst-A*%3E-to5538474.html#a5596...http://old.nabble.com/%28de%29serializing-map%3Cconst-A*%3E-to5538474.html#a...
And here it is what I have got in my problem :
boost::shared_ptr<const TT> jj(new TT(5));
{ boost::archive::xml_oarchive oa(ofs); oa & BOOST_SERIALIZATION_NVP(jj); }
boost::shared_ptr<const TT> rjj;
{ void* xptr=&rjj; boost::shared_ptr<TT> *xxptr; xxptr=static_cast< boost::shared_ptr<TT> * > (xptr); boost::archive::xml_iarchive ia(ifs); ia & BOOST_SERIALIZATION_NVP(*xxptr); }
This is undefined behavior. I would strongly advise against it if there is a reasonable alternative. In Christ, Steven Watanabe