//Purpose: // Explore differences in ways iostreams filtering is done // with different device types. //Acknowledgements: // Original code from post: /* From: Ken Appleby Newsgroups: gmane.comp.lib.boost.user Subject: Re: [iostreams] How can I use the Stream Insertion operator (<<) with a filtering_streambuf? Date: Fri, 26 Jul 2013 18:06:47 +0100 Lines: 94 */ //ChangeLog: // 2013-07-29.0847 // Converted to use: // filtering_estream // instead of: // filtering_streambuf // after reading post: /* From: Stephen Greenfield Newsgroups: gmane.comp.lib.boost.user Subject: Re: [iostreams] How can I use the Stream Insertion operator (<<) with a filtering_streambuf? Date: Mon, 29 Jul 2013 04:28:04 +0000 Lines: 167 */ //========================== #include #define USE_STRINGSTRM //use stringstream instead of fstream. #ifdef USE_STRINGSTRM #include #else #include #endif #include #include #include namespace bio = boost::iostreams; int main() { std::cout<<"USE_STRINGSTRM=" #ifdef USE_STRINGSTRM <<"yes defined" #else <<"not defined" #endif <<"\n"; std::string expected_text //storage for output to be compressed. ; {//make expected_text just list of numbers //delimited by { , and }. std::ostringstream expected_strm //used to compose output to be compressed. ; expected_strm<<"{ "; for(unsigned i=0; i<10; ++i) { if(i) expected_strm<<", "; expected_strm<