Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-01-27 15:38:41

Paul Giaccone wrote:
> Seweryn Habdank-Wojewódzki wrote:

> I raised this issue a few months ago. It turns out that the only way
> of closing a stream at the end of serialisation is to leave the scope
> in which the stream was opened. The reason for this is, I believe,
> so that a "footer" can be written to the stream indicating the end of
> the file.

This is a requirement of the xml_archive - I suppose a "close" function
could be added to the xml_archive so that one woudn't have to depend
on the destructor being called - but then one would want to add
it to all the archives where it would be a no-op.

It seems to me that it would just not be worth it to avoid the
alternative. In fact, I rather prefer the {} alternative - it makes
more sense to me.

> It would be handy, as Seweryn suggests, if there could be a close()
> function available to users that did this, so that users could close
> the stream *** you mean "close the archive" - leaving the stream open?***
>when they needed to.

One application of this is allowing a
> stream to be used for writing and then reading within the same scope.
> At the moment, a new scope is required to do this.

Robert Ramey

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at