Modify

Opened 9 years ago

Last modified 9 years ago

#2326 assigned Bugs

Library does not directly support serializing data of type "foo**"

Reported by: anonymous Owned by: Robert Ramey
Milestone: Boost 1.37.0 Component: serialization
Version: Boost 1.36.0 Severity: Problem
Keywords: Cc:

Description

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;

}

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by Robert Ramey

Status: newassigned

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Robert Ramey.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.