Boost logo

Boost Users :

Subject: [Boost-users] Serialization with pointer to const object
From: Soumen (soumen78_at_[hidden])
Date: 2009-07-24 02:23:55


Hi,

I'm using gcc 4.2.2 and boost 1.35. If I try to serialize pointer to some
const objects, I'm getting compilation problem. Is there any limitation? Or
I need to do certain things differently? I couldn't figured any solution
over net. If there already exist any topic which points to solution, please
point me to that. Otherwise, guide me to resolve the problem at hand. I'm
new to boost.

Say, my data member in the class myClass is

const myType *ptr;

In the serialize() routine, I'm doing it in following way:

template< class Archive >
void myClass::serialize(Archive &ar, const unsigned int version)
{
   ar & ptr;

   // I've tried "ar & const_cast< myType* >(ptr)" and
   // "ar & (myType *) ptr" as well - it didn't work

   /* serialize other members */

}

Regards,
- Soumen

-- 
View this message in context: http://www.nabble.com/Serialization-with-pointer-to-const-object-tp24639258p24639258.html
Sent from the Boost - Users mailing list archive at Nabble.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