Opened 16 years ago
Closed 14 years ago
#791 closed Feature Requests (fixed)
iostreams::tee_filter is for output only
| Reported by: | alexis_wilke | Owned by: | Jonathan Turkanis |
|---|---|---|---|
| Milestone: | Boost 1.36.0 | Component: | iostreams |
| Version: | None | Severity: | Problem |
| Keywords: | Cc: |
Description
I faught the C++ compiler for a little while before I realized that the iostreams::tee_filter was written as an output filter only. I needed it to work for an input chain and I do not see why there is such a limitation. My idea is to catch a copy of the data somewhere in the chain before it gets transformed further. Whether it is input our output it should work, right? (at least in theory...) Anyone has input in that regard? Thank you, Alexis Wilke
Change History (4)
comment:1 by , 16 years ago
comment:2 by , 15 years ago
| Component: | None → iostreams |
|---|---|
| Severity: | → Problem |
comment:3 by , 15 years ago
| Milestone: | → Boost 1.36.0 |
|---|---|
| Type: | Bugs → Feature Requests |
When I wrote tee, I couldn't think of a way to apply the concept to an input stream, but your idea looks pretty good. I will consider it for 1.36.
comment:4 by , 14 years ago
| Resolution: | None → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.

Logged In: YES user_id=554061 Originator: YES I propose the following additional function and adding multichar_input_filter_tag to the category. My software seems to work just fine with this addition. template<typename Source> std::streamsize read(Source& src, char_type* s, std::streamsize n) { int c; char_type* first = s; char_type* last = s + n; while ( first != last && (c = boost::iostreams::get(src)) != EOF && c != WOULD_BLOCK ) { *first++ = c; } std::streamsize result = static_cast<std::streamsize>(first - s); if(result == 0) { return c; } std::streamsize result2 = iostreams::write(this->component(), s, result); (void) result2; // Suppress 'unused variable' warning. assert(result == result2); return result; }