Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-03-12 16:33:53


Dan Leibovich wrote:
> Hi,
>
> Do you have any update?
> I will really appreciate any direction on how to proceed.
>
> Thanks
> Dan
>

I did spend a little time with it. I'm not sure what's missing
but here is my current test. I did make pass by
avoiding usage of a 0 valued pointer. So this
suggests that there someing amiss with the
serialization of such pointers in this demo.

I'm quite confident this is an issue with
this particular archive demo as the test
suite explicitly tests for this.

Robert Ramey

#include <boost/archive/text_oarchive.hpp>

#include <boost/archive/text_iarchive.hpp>

#include <fstream>

class A {

public:

int x;

A* a ;

template<class Archive>

void serialize (Archive & ar, const unsigned int version) {

ar & x ;

ar & a ;

};

A() {}

A(int x_) : x(x_), a(0) {} // this fails

//A(int x_) : x(x_), a(this) {} // this works

virtual void foo() {} ; // if removed - another kind of assert };

};

int main() {

char* file = "c:\\temp\\file" ;

std::ofstream ofs(file, std::ios::binary) ;

portable_binary_oarchive oar(ofs) ;

const A a(1);

oar << a ;

ofs.close() ;

A aa ;

std::ifstream ifs(file, std::ios::binary) ;

portable_binary_iarchive iar(ifs) ;

iar >> aa ;

}


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