title: boost::iostreams::copy() closes the source but not the sink
body: <p>I am trying to use boost::iostreams to compress data.</p>
  
  <p>The doc for <a href="http://www.boost.org/doc/libs/1_55_0/libs/iostreams/doc/functions/copy.html" rel="nofollow">copy()</a> says that its two arguments are closed at the end by calling the template function <a href="http://www.boost.org/doc/libs/1_55_0/libs/iostreams/doc/functions/close.html" rel="nofollow">close()</a> on both of them. My test code is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  #include &lt;boost/iostreams/filtering_streambuf.hpp&gt;
  #include &lt;boost/iostreams/copy.hpp&gt;
  #include &lt;boost/iostreams/filter/gzip.hpp&gt;
  
  using namespace std;
  
  int main(void)
  {
      ifstream ifs("output", ios::binary);
      ofstream ofs("output.boost.gz", ios::binary);
  
      boost::iostreams::filtering_streambuf&lt;boost::iostreams::output&gt; out;
  
      out.push(boost::iostreams::gzip_compressor());
      out.push(ofs);
  
      cout &lt;&lt; (ifs.is_open() ? "ifs is opened" : "ifs not opened") &lt;&lt; endl;
      cout &lt;&lt; (ofs.is_open() ? "ofs is opened" : "ofs not opened") &lt;&lt; endl;
  
      boost::iostreams::copy(ifs, out);
  
      cout &lt;&lt; (ifs.is_open() ? "ifs is opened" : "ifs not opened") &lt;&lt; endl;
      cout &lt;&lt; (ofs.is_open() ? "ofs is opened" : "ofs not opened") &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>This test outputs:</p>
  
  <pre><code>ifs is opened
  ofs is opened
  ifs not opened
  ofs is opened
  </code></pre>
  
  <p>You can see that ofs is still opened. My question is: why? What does boost::iostreams::close() do when passed a filtering_streambuf object? </p>