Boost logo

Boost Users :

Subject: Re: [Boost-users] [repost][serialization] version handling in{save|load}_construct_data
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-01-10 13:20:37


> I'm afraid that does not entirely answer my question. I understand
> what the "if(3 < ar.get_library_version()){" guard is for. What
> puzzles is me is why you need to explicitly save the type
> serialization version number when this info is seemingly recovered in
> other contexts without any explicit user operation. Let me put it
> another way: consider a user defined type my_type with associated
> serialization code:
>
> template<class Archive>
> void serialize(Archive& ar,my_type & m,const unsigned int version)
> {
> ...
> }
>
> When serialize() is called internally by Boost.Serialization, version
> is
> correctly passed without the user explicitly saving this info as it
> happens in the code for collection serialization. Why this difference?
> Am i making myself clear as to what the root of my puzzlement
> is?

OK - I think I understand the question now. I looked back
through the SVN and it only went back to 2007 and the change
was already in there. So the truth is that I don't know the
answer. Even so, I'm going to hazard a guess.

The binary_archive have the facility to stream whole collections
as a group. This applies to arrays and vectors and perhaps
other collections yet to be defined. This facility will be used
if the items in the collection are of a type "is_bitwise_serializable".
This can save huge amounts of time. But it bypasses the
normal serialization so the version# and other traits are lost.
I believe this bit of code was used to remedy the situation. Looking
at the code I can't see how it does this - but I'm pretty
sure that that was the motivation and that it addressed the
problem. That's all can I can say without delving more deeply
into it. It's possible that mining the old list might shed some more
light on it.

Robert Ramey


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