|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-01-10 18:52:58
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk