|
Boost Users : |
From: Michel Pineau (mpineau1963_at_[hidden])
Date: 2007-06-15 12:15:37
Hello,
I think I have found something, but I would like you to confirm, in the get_helper (boost/serialization/shared_ptr.hpp), if the variable sph (See code: shared_ptr<void> sph;) represent the most derived class, and if we have mulitple inheritance, then we cannot cast (See code: return * static_cast<H *>(sph.get());) a void * to a base class. It has to be cast to the derived class first and then to the base class. What do you think?
template<class Archive, class H>
H &
get_helper(Archive & ar){
extended_type_info * eti = type_info_implementation<H>::type::get_instance();
shared_ptr<void> sph;
ar.lookup_helper(eti, sph);
if(NULL == sph.get()){
sph = shared_ptr<H>(new H);
ar.insert_helper(eti, sph);
}
return * static_cast<H *>(sph.get());
}
Thanks again,
Michel :)
----- Message initial ----
De : Robert Ramey <ramey_at_[hidden]>
À : boost-users_at_[hidden]
Envoyé le : jeudi 14 juin 2007, 18 h 43 min 51 s
Objet : Re: [Boost-users] Problem with boost serialization: shared_ptr
I looked over your code at it looks like it shoud be OK to me.
I Tried to compile it with my VC 71 system using boost 1.3 (cvs HEAD)
and I got an error at the following line:
class ABC : public IA, public IB, public IC
\BoostHead\libs\serialization\test\test_zmisc.cpp(85) : fatal error C1001:
INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
which looks to me to be an artifact of the test system. I'll look some more
if I can get the chance.
Robert Ramey
"Michel Pineau" <mpineau1963_at_[hidden]> wrote in message
news:478215.90532.qm@web53310.mail.re2.yahoo.com...
Hello,
I'm trying to serialize many boost::shared_ptr to the same object but
through different base classes. When I look at the boost::shared_ptr for the
base classes they are not properly set. I created a simple example that show
my problem. The test program output is:
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Faites des appels de PC à PC dans le monde entier ! Essayez le nouveau Yahoo! Québec Messenger avec Voix.
http://cf.messenger.yahoo.com/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net