Subject: [Boost-bugs] [Boost C++ Libraries] #2326: Library does not directly support serializing data of type "foo**"
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-09-15 03:40:35
#2326: Library does not directly support serializing data of type "foo**"
--------------------------+-------------------------------------------------
Reporter: anonymous | Owner: ramey
Type: Bugs | Status: new
Milestone: Boost 1.37.0 | Component: serialization
Version: Boost 1.36.0 | Severity: Problem
Keywords: |
--------------------------+-------------------------------------------------
The following example fails to compile, trying to find a .serialize()
member function in an int*. Clearly the user can program around this, but
serializing pointers-to-pointers seems a natural capability that should be
in the library.
#include <fstream>
#include "boost/archive/text_oarchive.hpp"
class foo {
friend class boost::serialization::access;
template<class archive>
void serialize(archive& ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_NVP(buff);
ar & BOOST_SERIALIZATION_NVP(ptr);
}
public:
foo() : ptr(&buff[3]) {}
int* buff[10];
int** ptr;
};
int main() {
foo f;
std::ofstream serial("serial");
boost::archive::text_oarchive oa(serial);
oa << BOOST_SERIALIZATION_NVP(f);
return 0;
}
-- Ticket URL: <http://svn.boost.org/trac/boost/ticket/2326> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC