shared_ptr & polymorphic_iarchive in 1.33.0
Has anybody tested loading of shared_ptr with polymorphic archives? All that I manage to achive is just a couple of errors: c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2039: 'basic_iarchive' : is not a member of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(52) : see declaration of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(72) : while compiling class-template member function 'void boost::archive::detail::interface_iarchive<Archive>::lookup_helper(const boost::serialization::extended_type_info *const ,boost::shared_ptr<T> &)' with [ Archive=boost::archive::polymorphic_iarchive, T=void ] c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(54) : see reference to class template instantiation 'boost::archive::detail::interface_iarchive<Archive>' being compiled with [ Archive=boost::archive::polymorphic_iarchive ] c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2662: 'boost::archive::detail::basic_iarchive::lookup_basic_helper' : cannot convert 'this' pointer from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive &' Reason: cannot convert from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive' Conversion requires a second user-defined-conversion operator or constructor
Its look like that lookup_basic_helper/insert_basic_helper has not been added to polymorphic_iarchive/polymorphic_oarchive and polymorphic_iarchive_impl/polymorphic_oarchive_impl classes by mistake. Also, interface_iarchive and interface_oarchive members lookup_helper and insert_helper should be transformed from void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->basic_iarchive::lookup_basic_helper(eti, sph); } to void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->lookup_basic_helper(eti, sph); } This works for me.
c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2039: 'basic_iarchive' : is not a member of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(52) : see declaration of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(72) : while compiling class-template member function 'void boost::archive::detail::interface_iarchive<Archive>::lookup_helper(const boost::serialization::extended_type_info *const ,boost::shared_ptr<T> &)' with [ Archive=boost::archive::polymorphic_iarchive, T=void ] c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(54) : see reference to class template instantiation 'boost::archive::detail::interface_iarchive<Archive>' being compiled with [ Archive=boost::archive::polymorphic_iarchive ] c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2662: 'boost::archive::detail::basic_iarchive::lookup_basic_helper' : cannot convert 'this' pointer from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive &' Reason: cannot convert from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive' Conversion requires a second user-defined-conversion operator or constructor
What compiler are you using? Do the serialization tests that touch polymorphic archives compile? Is test coverage sufficient? Robert Ramey Sergey Skorniakov wrote:
Its look like that lookup_basic_helper/insert_basic_helper has not been added to polymorphic_iarchive/polymorphic_oarchive and polymorphic_iarchive_impl/polymorphic_oarchive_impl classes by mistake. Also, interface_iarchive and interface_oarchive members lookup_helper and
insert_helper should be transformed from
void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->basic_iarchive::lookup_basic_helper(eti, sph); }
to
void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->lookup_basic_helper(eti, sph); }
This works for me.
c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2039: 'basic_iarchive' : is not a member of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(52) : see declaration of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(72) : while compiling class-template member function 'void boost::archive::detail::interface_iarchive<Archive>::lookup_helper(const boost::serialization::extended_type_info *const ,boost::shared_ptr<T> &)' with [ Archive=boost::archive::polymorphic_iarchive, T=void ] c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(54) : see reference to class template instantiation 'boost::archive::detail::interface_iarchive<Archive>' being compiled with [ Archive=boost::archive::polymorphic_iarchive ] c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2662: 'boost::archive::detail::basic_iarchive::lookup_basic_helper' : cannot convert 'this' pointer from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive &' Reason: cannot convert from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive' Conversion requires a second user-defined-conversion operator or constructor
What compiler are you using?
VC 7.1
Do the serialization tests that touch polymorphic archives compile?
All tests from libs\serialization\test succeedes - when running twise. First run of some tests has been failed. I had never runs serialization tests before and don't know why so can be happen. I think, my corrections doesn't broke anything. Also, my code that saves/loads polymorphic objects through shared_ptr<Base> to/from polymorphic archives also compiles and runs correctly.
Is test coverage sufficient?
I think thats that test coverage of polymorphic archives in current libriry version extremely insufficient. Indeed, I have found just one test that deals with polymorphic archives.
Robert Ramey
Sergey Skorniakov wrote:
Its look like that lookup_basic_helper/insert_basic_helper has not been added to polymorphic_iarchive/polymorphic_oarchive and polymorphic_iarchive_impl/polymorphic_oarchive_impl classes by mistake. Also, interface_iarchive and interface_oarchive members lookup_helper and
insert_helper should be transformed from
void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->basic_iarchive::lookup_basic_helper(eti, sph); }
to
void lookup_helper( const boost::serialization::extended_type_info * const eti, shared_ptr<void> & sph ){ this->This()->lookup_basic_helper(eti, sph); }
This works for me.
c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2039: 'basic_iarchive' : is not a member of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(52) : see declaration of 'boost::archive::polymorphic_iarchive' c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(72) : while compiling class-template member function 'void boost::archive::detail::interface_iarchive<Archive>::lookup_helper(const boost::serialization::extended_type_info *const ,boost::shared_ptr<T> &)' with [ Archive=boost::archive::polymorphic_iarchive, T=void ] c:\boost_1_33_0\boost\archive\polymorphic_iarchive.hpp(54) : see reference to class template instantiation 'boost::archive::detail::interface_iarchive<Archive>' being compiled with [ Archive=boost::archive::polymorphic_iarchive ] c:\boost_1_33_0\boost\archive\detail\interface_iarchive.hpp(73) : error C2662: 'boost::archive::detail::basic_iarchive::lookup_basic_helper' : cannot convert 'this' pointer from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive &' Reason: cannot convert from 'boost::archive::polymorphic_iarchive' to 'boost::archive::detail::basic_iarchive' Conversion requires a second user-defined-conversion operator or constructor
Can you explain your fix a little bit more? What did you fix in polymorphic_iarchive/polymorphic_oarchive and polymorphic_iarchive_impl/polymorphic_oarchive_impl classes? Thanks! -- Orhun Birsoy
I had attached corrected files to this message
"Orhun Birsoy"
Can you explain your fix a little bit more? What did you fix in polymorphic_iarchive/polymorphic_oarchive and polymorphic_iarchive_impl/polymorphic_oarchive_impl classes?
Thanks!
-- Orhun Birsoy
participants (3)
-
Orhun Birsoy
-
Robert Ramey
-
Sergey Skorniakov