
On 01/21/09 17:26, Larry Evans wrote: [snip]
However, I've looked further at indent.hpp and the storing of the pointer to the filter in the ios_base using ios_base::pword. What's the advantage of using ios_base::pword to store the pointer to something that's already available via basic_ios<...>::rd_buf and then filtering_streambuf<...>::component<T>(int):
http://www.boost.org/doc/libs/1_37_0/libs/iostreams/doc/classes/filtering_st...
This design is implemented in boost vault under the "Input - Output" directory in indent_scoped_ostreambuf.zip.
I believe there is a problem with this rdbuf/component<T>(int) combination that's illustrated by scoped_buf_swapper.zip in the "Input - Output" directory of the vault. The ios_base::pword store of indent_filter works because the filter is found by looking up the unique key of that filter in the ios_base. With the rdbuf/component<T> method, the component<T>(0) will return the 0 if more than one filter has been pushed onto the streambuf.