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
#include
#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 ;
}