Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] problem with free funciton splitting
From: Jonathan (Jonathan.Klein_at_[hidden])
Date: 2011-10-09 09:16:29


Well, I forgot to put the save/load functions into the
boost::serialization namespace - now it works.

Am 08.10.2011 13:06, schrieb Jonathan:
> Hi, i have a code like this:
>
>
> //LightSetup
> template<class Archive> void save(Archive &a, const Mrl::LightSetup&
> LightSetup, unsigned int version)
> {
> unsigned int Count=LightSetup.NumLights();
> a & serialization::make_nvp("Count", Count);
>
> for(unsigned int i=0; i<Count; ++i)
> {
> a & serialization::make_nvp("Light", LightSetup[i]);
> }
> }
>
> template<class Archive> void load(Archive &a, Mrl::LightSetup&
> LightSetup, unsigned int version)
> {
> unsigned int Count;
> a & serialization::make_nvp("Count", Count);
>
> LightSetup=Mrl::LightSetup();//clear everything
>
> for(unsigned int i=0; i<Count; ++i)
> {
> Light* NewLight=0;
> a & serialization::make_nvp("Light", NewLight):
> LightSetup.Add(Light);
> }
> }
>
> namespace boost { namespace serialization {
> template<class Archive>
> inline void serialize(
> Archive & ar,
> Mrl::LightSetup & t,
> const unsigned int file_version
> ){
> split_free(ar, t, file_version);
> }
> }}
>
> //BOOST_SERIALIZATION_SPLIT_FREE(Mrl::LightSetup)
>
> (I tried both version, the makro and the serialize implementations, both
> give me the same error).
>
> The compiler says:
> boost\boost/serialization/split_free.hpp(45): error C2664:
> 'boost::serialization::save': Konvertierung des Parameters 2 von 'const
> Mrl::LightSetup' in 'const boost_132::detail::shared_count &' nicht möglich
>
> (converting parameter 2 not possible).
>
> I have no idea what this shared_count is, so I don't know, what do do.
>
> King regards
>
> Jonathan Klein


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