Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization]Serialization of pointer to pointers
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-09-08 00:23:01


This a limitation has been noted on a track item. I could imagine
might be possible to work around it but for now it's a limitation

Robert Ramey

Kangkook Jee wrote:
> 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