From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-11-24 17:23:50
Jonathan Turkanis wrote:
> "Reece Dunn" <msclrhd_at_[hidden]> wrote in message
>>I am playing around with the library. Here are a few thoughts:
>> And is it possible to access Sink members from stream_facade, for
> This would require stream_facade to derive from the policy class, which I didn't
> do for several reasons. The way to access the policy is with operators * or ->:
> stream_facade< speech_reader > speech;
> speech->set_pitch( 50 );
> // Or: (*speech).set_pitch( 50 );
That is still just as good :).
>> I would like to collapse:
>> std::ofstream out( "encoded.txt" );
>> boost::io::filtering_ostream os;
>> os.push( ascii85_encoder());
>> os.push( out );
>> os << ...;
>> class ascii85_ofstream: public boost::io::filtering_ostream
>> std::ofstream out;
>> ascii85_ofstream( const char * fn ): out( fn )
>> push( ascii85_encoder());
>> push( out );
>> ascii85_ofstream os( "encoded.txt" );
>> os << ...;
> Yes, this is certainly one of the intended uses of the library.
>>but this results in a crash at the destructor (tested with msvc-8.0).
> I believe the problem is that the filtering_ostream (a base class) is accessing
> the ofstream (a member of a derived class) after the ofstream has been
This was my thoughts as well.
> This would be unacceptable even if filtering_ostream had a
> no-close-on-exit option. I believe the solution is to pop the ofstream in the
> ascii85_ofstream destructor.
> pop(); // Or: reset();
> Please let me know if this works.
pop() does indeed fix the problem :).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk