Boost logo

Boost :

Subject: [boost] [serialization] register_type order dependent?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-08-27 10:02:55


Is it expected that the calls to register_type need to be identical on
both the save and load side of a serialization exchange? I thought I
read that the registration facility sets up a map. But the following
caused a archive_exception.

struct C {};
struct B : C {};
struct A : B {};

--- save

boost::archive::text_oarchive oa(some_ostream);

oa.register_type(static_cast<A*>(0));
oa.register_type(static_cast<B*>(0));
oa.register_type(static_cast<C*>(0));

oa & aC_ptr;

--- load

boost::archive::text_iarchive ia(some_istream);

ia.register_type(static_cast<B*>(0));
ia.register_type(static_cast<A*>(0));
ia.register_type(static_cast<C*>(0));

oa & aC_ptr;

Thanks, Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk