Boost logo

Boost Users :

Subject: [Boost-users] [Serialization]Serialization of pointer to pointers
From: Kangkook Jee (aixer77_at_[hidden])
Date: 2011-09-07 16:48:55


Hi, all

I'm trying to use boost library for serialization of my program which contains many custom class definitions.
However, I can't figure out how to handle a class member which is *pointer to pointers* such as 'a' from the following code snippet.

class B {
 A** a;
 friend class boost::serialization::access;

 template<class Archive>
 void serialize(Archive &ar, const unsigned int version) {
   ar & a:
….

Above code fails to be compiled with the following error message.


/usr/include/boost/archive/detail/oserializer.hpp:148:5: instantiated from ‘void boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::text_oarchive, T = A*]’
serial0.cpp:118:1: instantiated from here
/usr/include/boost/serialization/access.hpp:118:9: error: request for member ‘serialize’ in ‘t’, which is of non-class type ‘A*’

Do we have a typical way to handle a such case?
I spend some time to find a solution from the web and tutorials but I couldn't.

I'm new to the boost library and your helps will be greatly appreciated.

Thanks, Kangkook


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