Re: [Boost-users] [iostreams] inverse and "stateful" filters

From: EMalenfant@interstarinc.com
Consider the following, using dictionary_output_filter from the tutorial: (http://www.boost.org/libs/iostreams/doc/index.html?path=2.2.6.3)
namespace io = boost::iostreams;
const std::string source("This foo will be bar");
io::example::dictionary dict; dict.add("foo", "bar");
io::filtering_istream in; in.push(io::invert(io::example::dictionary_output_filter(dict))); in.push(io::array_source(source.c_str(), source.length()));
io::copy(in, std::cout);
Output: This bar will be
instead of the expected: This bar will be bar
Digging a bit, I found that I could "fix" that problem by modifying
invert::read() as follows:
template<typename Source>
std::streamsize read(Source& src, char* s, std::streamsize n)
{
typedef detail::counted_array_sink
participants (1)
-
EMalenfant@interstarinc.com