Never mind. Thanks all -- I fixed it myself. For the archives, in trying to print each level in my hierarchy I had a helper function like this;
template<typename T>
struct printeachlevel
{
printeachlevel(T& ar) : m_ar(ar) { }
template<typename X>
void operator()(X*& level)
{
m_ar & boost::serialization::make_nvp(level->m_myNodeName.c_str(), level);
}
T& m_ar;
};
The problem was the function operator took a const X*& level -- so when the typename X was class Stock, it turned it into a const Stock*& and that probably made the boost serialization library mad at me.
anyway, teaches me to first look at the compiler error carefully before posting in archives :-)
I hope I don't run into another one the moment I hit send ;-)
Hello all
I am trying to use Boost Serialization library to de-serialize a complex object hierarchy from XML to its class representation.
The class hierarchy gets serialized into XML just fine. But while trying to do the reverse, that is read from XML and pump it into my class, I run into the following compiler error that is driving me nuts. Can someone help please? FYI if its relevant I have a std::list<Stock*> datatype in one of the classes.
The error dump is slightly big so I apologize in advance. The compiler is VC 7.1 on windows XP.
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(487) : error C2440: 'reinterpret_cast' : cannot convert from 'const Stock **__w64 ' to 'void ** '
Conversion loses qualifiers
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(484) : while compiling class-template member function 'void boost::archive::detail::load_pointer_type<Archive,Tptr>::invoke(Archive &,Tptr & )'
with
[
Archive=boost::archive::xml_iarchive,
Tptr=const Stock *
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(572) : see reference to class template instantiation 'boost::archive::detail::load_pointer_type<Archive,Tptr>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
Tptr=const Stock *
]
C:\Boost\include\boost-1_33_1\boost\archive\basic_xml_iarchive.hpp(80) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T & )' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const Stock *
]
C:\Boost\include\boost-1_33_1\boost\archive\xml_iarchive.hpp(74) : see reference to function template instantiation 'void boost::archive::basic_xml_iarchive<Archive>::load_override<const X*>(const boost::serialization::nvp<T> &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
X=Stock,
T=const Stock *
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(76) : see reference to function template instantiation 'void boost::archive::xml_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<const Stock *>
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(83) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><T>(T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<const Stock *>
]
MarketData.cpp(118) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator &<const boost::serialization::nvp<T>>(const boost::serialization::nvp<T> &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const Stock *
]
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(21) : see reference to function template instantiation 'void printeachlevel<T>::operator ()<Stock>(const X *& )' being compiled
with
[
T=boost::archive::xml_iarchive,
X=Stock
]
MarketData.cpp(131) : see reference to function template instantiation '_Fn1 std::for_each<std::list<_Ty>::iterator,printeachlevel<T>>(_InIt,_InIt,_Fn1)' being compiled
with
[
_Fn1=printeachlevel<boost::archive::xml_iarchive>,
_Ty=Stock *,
T=boost::archive::xml_iarchive,
_InIt=std::list<Stock *>::iterator
]
C:\Boost\include\boost-1_33_1\boost\serialization\access.hpp(109) : see reference to function template instantiation 'void Stocks::serialize<Archive>(Archive &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(164) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\serialization\extended_type_info_typeid.hpp(74) : while compiling class-template member function 'void boost::archive::detail::iserializer<Archive,T>::load_object_data(boost::archive::detail::basic_iarchive &,void *,const unsigned int) const'
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(375) : see reference to class template instantiation 'boost::archive::detail::iserializer<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(369) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(425) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\includ
e\boost-1_33_1\boost\archive\detail\iserializer.hpp(418) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(572) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\basic_xml_iarchive.hpp(80) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\xml_iarchive.hpp(74) : see reference to function template instantiation 'void boost::archive::basic_xml_iarchive<Archive>::load_override<Stocks>(const boost::serialization::nvp<T> &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(76) : see reference to function template instantiation 'void boost::archive::xml_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<Stocks>
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(83) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><T>(T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<Stocks>
]
MarketData.cpp(179) : see reference
to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator &<const boost::serialization::nvp<T>>(const boost::serialization::nvp<T> &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Stocks
]
C:\Boost\include\boost-1_33_1\boost\serialization\access.hpp(109) : see reference to function template instantiation 'void Securities::serialize<Archive>(Archive &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(164) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\serialization\extended_type_info_typeid.hpp(74) : while compiling class-template member function 'void boost::archive::detail::iserializer<Archive,T>::load_object_data(boost::archive::detail::basic_iarchive &,void *,const unsigned int) const'
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(375) : see reference to class template instantiation 'boost::archive::detail::iserializer<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(369) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(425) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(418) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(572) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\basic_xml_iarchive.hpp(80) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33
_1\boost\archive\xml_iarchive.hpp(74) : see reference to function template instantiation 'void boost::archive::basic_xml_iarchive<Archive>::load_override<Securities>(const boost::serialization::nvp<T> &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(76) : see reference to function template instantiation 'void boost::archive::xml_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<Securities>
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(83) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><T>(T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<Securities>
]
MarketData.cpp(209) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator &<const boost::serialization::nvp<T>>(const boost::serialization::nvp<T> &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Securities
]
C:\Boost\include\boost-1_33_1\boost\serialization\access.hpp(109) : see reference to function template instantiation 'void MarketData::serialize<Archive>(Archive &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=Mar
ketData
]
C:\Boost\include\boost-1_33_1\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(164) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\serialization\extended_type_info_typeid.hpp(74) : while compiling class-template member function 'void boost::archive::detail::iserializer<Archive,T>::load_object_data(boost::archive::detail::basic_iarchive &,void *,const unsigned int) const'
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(375) : see reference to class template instantiation 'boost::archive::detail::iserializer<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(369) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(425) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>::load_standard' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(418) : while compiling class-template member function 'void boost::archive::detail::load_non_pointer_type<Archive,T>::invoke(Archive &,T &)'
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(572) : see reference to class template instantiation 'boost::archive::detail::load_non_pointer_type<Archive,T>' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\basic_xml_iarchive.hpp(80) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\xml_iarchive.hpp(74) : see reference to function template instantiation 'void boost::archive::basic_xml_iarchive<Archive>::load_override<MarketData>(const boost::serialization::nvp<T> &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\interface_iarchive.hpp(76) : see reference to function template instantiation 'void boost::archive::xml_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=const boost::serialization::nvp<MarketData>
]
MarketData.cpp(223) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><const boost::serialization::nvp<T>>(const boost::serialization::nvp<T> &)' being compiled
with
[
Archive=boost::archive::xml_iarchive,
T=MarketData
]
C:\Boost\include\boost-1_33_1\boost\archive\detail\iserializer.hpp(493) : error C2664: 'const T *boost::archive::detail::load_pointer_type<Archive,Tptr>::pointer_tweak<const X>(const boost::serialization::extended_type_info &,void *,const T &)' : cannot convert parameter 2 from 'const Stock *' to 'void *'
with
[
T=Stock,
Archive=boost::archive::xml_iarchive,
Tptr=const Stock *,
X=Stock
]
Conversion loses qualifiers