
"Dietmar Kuehl" <dietmar_kuehl@yahoo.com> wrote in message news:200409031908.13053.dietmar_kuehl@yahoo.com...
|On the ACCU 2003 conference JC (I can figure out the full name if |necessary...) presented the idea for creating filters which I really |liked. It looked something like this:
|filter_stream out(tee(std::cout) | encode | gzip | file("some file"));
|This would create a stream which writes everything to 'std::cout' |and also encodes the stuff before sending it on to compress it and |finally write it to the file. I like this notation...
I second that
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. Robert Ramey

"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

On Fri, Sep 03, 2004 at 08:42:36AM -0700, Robert Ramey wrote:
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
I second that just one syntax is best. And why not the one that uses push? -- Carlo Wood <carlo@alinoe.com>
participants (3)
-
Carlo Wood
-
Jonathan Turkanis
-
Robert Ramey