Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Using Boost serialization, boost_shared pointer does not work.. give compile time error

$
0
0

Hi All,
 
I'm trying to serialize shared pointer using boost but it gives error :
Error 1 error C4308: negative integral constant converted to unsigned type c:\users\mydirect\future\lib\boost_1_55_0\boost\mpl\print.hpp 51 1 Input
 
Spent more than 2 days on this but no clue.. when i comment line "ar & MyInfo" error does not come so it means surely issue is with shared pointer.. how do i go ahead.
 
Below is the code :
 
// MyData.hpp file
struct MyData
{
std::string id;
std::string name;
boost::shared_ptr<mydata> Mydata; 
 
private:
friend class boost::serialization::access;
template<class archive="">
void serialize(Archive &ar, const unsigned int version)
{
ar & id;
ar & name;
ar & Mydata;  // When i comment this line, error goes off

 
public:
MyData(void);
MyData(const parameter_strings & parms);
 
virtual ~MyData(void);
};
}
 
// MyData.cpp file
 
MyData::MyData(void)
{
}
 
MyData::~MyData(void)
{
}
 
MyData::MyData(const parameter_strings & parms)
{
// implementation aprt
}
 
BOOST_CLASS_EXPORT_IMPLEMENT(MyData); BOOST_CLASS_IMPLEMENTATION(MyData,boost::serialization::object_serializable);
BOOST_CLASS_TRACKING(MyData,boost::serialization::track_selectively);</class></mydata>

I tried so many options or code but no use.. still issue exists. Really need urgent help on this.




Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>