
On Feb 7, 2008 4:54 AM, Jonathan Turkanis
Stefan Arentz wrote:
I've written a really simple aggregate_filter that runs the world famous and highly secret ROT13 encryption. This filter works fine when I use a file_sink and file_source. But I really just want to run this on a bunch of string buffers. Unfortunately it does not work, the destination string is always empty. Does anyone understand why?
This is the same problem discussed in your other thread 'Another desperate ...'. It can be solved the same way, using reset() or pop().
I guess this would be a good place to ask: As a newcomer to the iostreams library, would you be surprised if
copy(in, out)
where in and out are filter chains, automatically popped both chains, assuming this behavior was clearly documented?
Hi Jonathan, For me 'copy' means that data is moved from source to destination without any additional actions from my part. Whether it pops() or resets() the filter internally is ok, as long as it is part of the copy procedure and documented behaviour as you say. I find both operations, pop or reset, very misleading in this case though. They are the last thing you think of when what you really want to do is 'flush' the final bits of the copy. Another thing that would be really nice would be the ability to do something like this: copy(src, base64_decoder() | aes_filter("Secret") | gzip_decompressor(), dst); Or maybe even a shortcut like: std::string src, dst; filter(src, base64_decoder() | ...more ... | ...filters ... | gzip_decompressor(), dst) Since I think a lot of people are operating directly on strings. S.