
"Robert Ramey" <ramey@rrsd.com> wrote in message news:20040903154235.58E9A31254@acme.west.net...
"Dietmar Kuehl" <dietmar_kuehl@yahoo.com> wrote:
|filter_stream out(tee(std::cout) | encode | gzip | file("some file"));
FWIW - I do NOT like this idea. I concede its mostly a matter of taste but I think it adds another layer of syntax. I think the original .. push, etc is ok. But my preference would be for
filter_stream out( tee( std::out, encode( gzip( file("somefile") ) ) ) )
I'm sure people are going to love this idea.
This is sort of like how Crypto++ works. There's a convention that filters have to have constructors allowing them to be chained. I'd rather not do this, however, since often filters will have other parameters that have to be passed to their constructors, and if they multiple constructors, forcing them to add a templated parameter at the end (or beginning) could lead to ambiguity, esp. on weak compilers. It's also puts the burden on filter and resource writes, rather than on the library itself. An alternative is this: filtering_ostream out( link( tree(std::out), encode(), gzip(), file() ) ); This was actually part of the library until recently, when I axed it to make the library smaller. Jonathan