After spending quite some time debugging the issue today, I noticed the boost::iostream::filtering_ostream needs to be destroy for the sink to be written.
Test code:
#include
#include
#include
struct ZlibOstream : boost::iostreams::filtering_ostream
{
ZlibOstream(std::ostream& os)
{
boost::iostreams::filtering_ostream::push(boost::iostreams::zlib_compressor{});
boost::iostreams::filtering_ostream::push(os);
}
};
int main()
{
std::ostringstream oss;
#ifdef HAS_SCOPE
{
#endif
ZlibOstream zlibOstream{oss};
zlibOstream << "This is a test string.\n";
#ifdef HAS_SCOPE
}
#endif
return (oss.tellp() == 0);
}
Calling flush() doesn't do the trick and I don't need to do this when I remove the zlib_compressor.
Result with coliru:
https://coliru.stacked-crooked.com/a/7cd166d2d820e838
What would be the reason behind this behavior ?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)