Boost logo

Boost Users :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2006-01-30 09:31:53


Robert Ramey wrote:

>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
>
>
OK, if it is more hassle than it is worth, that is fine, as I saw you
posted a way of writing and reading in the same scope a few days ago.

Is the necessity of closing the scope to complete the write in the
documentation?


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