title: implementing simple input stream
body: <p>I want to write a simple <code>istream</code> object, that would simply transform another <code>istream</code>.</p>
  
  <p>I want to only implement <code>readline</code> (which would read a line from the original stream, would process it, and return the processed line), and have some generic code that upon <code>read</code> would use my read line, cache it, and give the required amount of bytes as output.</p>
  
  <p>Is there any class that would allow me to do that?</p>
  
  <p>For example</p>
  
  <pre><code>struct mystream : istreamByReadLine {
    istream&amp; s;
    mystream(istream&amp; _s):s(_s){}
    virtual string getline() {
      string line;
      getline(s,line);
      f(line);
      return line;
    }
  }
  
  class istreamByReadLine : istream {
    ... // implementing everything needed to be istream compatible, using my
    ... // getline() virtual method
  }
  </code></pre>