
I mentioned in an earlier response to JT that I have written a function to filter adapter. The entire code is now online at http://www.cdiggins.com/iostreams_fxn_filters.hpp I can't help but wonder if the syntax for chaining streams to filters shouldn't be cin >> fxn_filter(fxn) >> cout; instead of cin | fxn_filter(fxn) | cout; Anyone have any thoughts on the subject? Would anyone else, other than me, like to see this functionality added to iostreams? - Christopher Diggins Object Oriented Template Library (OOTL) http://www.ootl.org

christopher diggins wrote:
I mentioned in an earlier response to JT that I have written a function to filter adapter. The entire code is now online at http://www.cdiggins.com/iostreams_fxn_filters.hpp
I can't help but wonder if the syntax for chaining streams to filters shouldn't be
cin >> fxn_filter(fxn) >> cout;
instead of
cin | fxn_filter(fxn) | cout;
Anyone have any thoughts on the subject? Would anyone else, other than me, like to see this functionality added to iostreams?
I certainly wouldn't want two operators that do the same thing. So the question is whether to replace | with >>. Following JC van Winkel and John van Krieken, I chose | because of the close analogy with the UNIX pipe operator. Another reason is that someone might want to write inserters and extractors for a filter or device type, which would then interfere with the piping mechanism. Also xxx >> cout looks like an error to me. Jonathan

On Mon, Jan 10, 2005 at 04:52:58PM -0700, Jonathan Turkanis wrote:
christopher diggins wrote:
I mentioned in an earlier response to JT that I have written a function to filter adapter. The entire code is now online at http://www.cdiggins.com/iostreams_fxn_filters.hpp
I can't help but wonder if the syntax for chaining streams to filters shouldn't be
cin >> fxn_filter(fxn) >> cout;
instead of
cin | fxn_filter(fxn) | cout;
Anyone have any thoughts on the subject? Would anyone else, other than me, like to see this functionality added to iostreams?
I certainly wouldn't want two operators that do the same thing. So the question is whether to replace | with >>. Following JC van Winkel and John van Krieken, I chose | because of the close analogy with the UNIX pipe operator. Another reason is that someone might want to write inserters and extractors for a filter or device type, which would then interfere with the piping mechanism. Also
xxx >> cout
looks like an error to me.
I strongly agree. Using operator| makes it clear something other than standard IOStream syntax is being used. jon -- "Surrealism aims at the total transformation of the mind and all that resembles it" - Breton
participants (3)
-
christopher diggins
-
Jonathan Turkanis
-
Jonathan Wakely