|
Boost : |
Subject: Re: [boost] [serialization] register_type order dependent?
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-27 13:57:25
Jeff Flinn wrote:
> Is it expected that the calls to register_type need to be identical on
> both the save and load side of a serialization exchange?
It is required.
> I thought I read that the registration facility sets up a map.
It does. But the mapping has to be loaded in the order it was created
> 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
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk