Flushing a boost::iostreams::zlib_compressor. How to obtain a "sync flush"?
boost, boost-iostreams, c++, flush, zlib
Solution
It turns out there is a fundamental problem that the `symmetric_filter` that `zlib_compressor` inherits from isn't itself flushable (which seems rather an oversight).
Possibly adding such support to `symmetric_filter` would be as simple as adding the `flushable_tag` and exposing the existing private flush methods, but for now I can live with it.
Problem
Is there some magic required to obtain a "zlib sync flush" when using `boost::iostreams::zlib_compressor` ? Just invoking `flush` on the filter, or `strict_sync` on a `filtering_ostream` containing it doesn't see to do the job (ie I want the compressor to flush enough that the decompressor can recover all the bytes consumed by the compressor so far, without closing the stream). Looking at the header, there seem to be some "flush codes" defined (notably a `sync_flush`) but it's unclear to me how they should be used (bearing in mind my compressor is just added into a `filtering_ostream`).