1 Mar 11:58
manipulators for filtering_stream s
Roland Schwarz <roland.schwarz <at> chello.at>
2008-03-01 10:58:33 GMT
2008-03-01 10:58:33 GMT
Larry Evans wrote: > A long time ago, I had one and was intending *eventually* to add it to > iostreams, but never got around to it. It's in: > > http://svn.boost.org/trac/boost/browser/sandbox-branches/cppljevans/boost/io/filters Thank you. Al though google revealed some postings about margin_ostream it failed to get me to the sources. I am not sure however you noticed the difference to my implementation: I am storing state _in_ the stream, i.e. in ios base member and thus allowing out << indent_in << "blah blah\n"; out << "still indented\n"; And a function void foo(ostream& os) that gets passed down my indent_filter'ed stream still knowns the indentation status. The margin_ostream implements indent operation only the stream object. Does is also have manipulators? Will margin_ostream also work when downcasted to a plain ostream? -- -- _________________________________________(Continue reading)
> however, I'm getting wrong output :(
Hmm, I did not test it, but from looking at your source:
marg_ostream& mout(void)
{
return std::cout;
}
gives you back std::cout, while it should hand back
; boost::iostreams::filtering_ostream out
The state is stored in out instance of course,
not cout.
RSS Feed