
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