Boost logo

Boost Users :

From: Chad Walters (chad_at_[hidden])
Date: 2008-02-04 15:33:03


>But when looking at the source of copy() I see there is no close() done at all.

The "two stream" version of iostreams::copy() does instantiate exernal_closer for both the source and the sink, which should result in close() being called if they have the closable_tag in their category. I think your filters and devices do this based on what I can tell, but you may wish to verify that.

>Is anyone actually using the library? I can't believe I'm the first
> finding a bug like this in a 5 year old library.

I did report a somewhat general problem with the close implementation which was biting me with certain filters: http://svn.boost.org/trac/boost/ticket/1002. Jonathan has recently fixed that problem. I am not sure this is related to your problem but you might want to see about applying those changes. If you are still having problems after that, I'd be happy to investigate further with you - I am pretty familiar with the close() implementation at this point.

We are using iostreams quite extensively - the close issue mentioned above was the only problem that didn't turn out to be user error on our part.

Chad

On Feb 4, 2008 6:33 PM, Stefan Arentz <stefan.arentz_at_[hidden]> wrote:
> I'm looking for some help with the following code where I try to
> implement an aggregate filter and a sink. This super simple example is
> supposed to print the xorred input but instead it prints:
>
> The result is:
> do_filter
> write: 01+x1+x,*!x76=
>
> Does anyone understand why the filtering and sink.write are not done
> as part of the copy operation? The last two lines should be printed as
> part of the copy process! It seems they are executed as part of
> destructing these objects instead?

I got a very useful hint on the #boost irc channel about this: calling
out.reset() after the copy() made the code work correctly.

I'm a confused about this though since the documentation of copy states:

"The function template copy reads data from a given model of Source
and writes it to a given model of Sink until the end of stream is
reached. It then closes both components, using the function template
close, and returns the number of characters written."

But when looking at the source of copy() I see there is no close() done at all.

Is anyone actually using the library? I can't believe I'm the first
finding a bug like this in a 5 year old library.

 S.



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