Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-05-24 16:27:54


Robert Ramey wrote:
> This is explainined in the section - "rationale" in the documentation.
> The following changes would make it work;

>>int _tmain(int argc, _TCHAR* argv[])
>>{
>> Table aTable;
>
> {
> const Table & stable = aTable;
>
>> ofstream ofs( "Settings.txt" );
>> boost::archive::text_oarchive oa( ofs );
>> oa << sTable;

Robert,

This issues seems to pop up again and again. It's just *so*
surprising (nobody reads through all the docs of a library when they
start to use it).

As you remember, I had to contact you personally to help me with
Pointer Container Serialization --- it was not because I hadn't tried
before contacting you (I spent hours trying to figure out what was
wrong). (I have documented a seperate todo-list for people using
Boost.Pointer Container and serialization just to remember them of this
isssue!).

There has to be a better way. I read through your scenario again:

    http://www.boost.org/libs/serialization/doc/rationale.html#trap

and I don't get very much of it.

I understand the need for ensuring

1. no invalid archives are created.
2. no data is lost.
3. no runtime errors occur.

but there has to be a better way, even if it means
3 becomes a runtime exception.

Somehow the information of a class and how it is serialized must be
localized ***in one place only*** so one programmer can't ruin the
archieve of another programmer without his knowlegde.

If this means

1. that by default, you can't serialize a pointer (you must ask for it),

or

2. that by default, you have to define BOOST_SERIALIZATION_TRACKING

that's ok. But something has to be done.

-Thorsten

BTW: I'm ok with

T * t;
ar >> t;

failing (just make it part of the toturial). That's completely different
from reading from an object.


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