views:

32

answers:

0

Hello everyone,

I'm working with some code which writes to a wostream. I'd like take its output and write it to a gzip'ed file. This seemed like a good job for boost::iostreams. However, my attempts so far at this haven't been successful. (in all the below, assume using namespace boost::iostreams and that I have some function void my_func(wostream&))

If I do,

filtering_wostream gzOut;
gzOut.push(gzip_compressor());
my_func(gzOut);

I get:

C:\boost_1_40_0\boost/iostreams/chain.hpp(249) : error C2664: 'std::list<_Ty>::push_back' : cannot convert parameter 1 from 'streambuf_t *' to 'boost::iostreams::detail::linked_streambuf<Ch> &'
        with
        [
            _Ty=boost::iostreams::detail::linked_streambuf<wchar_t> *
        ]
        and
        [
            Ch=wchar_t
        ]
        Reason: cannot convert from 'streambuf_t *' to     'boost::iostreams::detail::linked_streambuf<Ch> '
        with
        [
            Ch=wchar_t
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

On the other hand, if I do:

filtering_ostream gzOut; // only difference is "ostream" instead of "wostream"
gzOut.push(gzip_compressor());
my_func(gzOut);

I unsurprisingly get:

error C2664: 'my_func' : cannot convert parameter 1 from  'boost::iostreams::filtering_ostream' to 'std::wostream &'

Thasnks very much for any help you can provide.