std::ostream printing address at end of function
<p>I have the following function:</p>

<pre><code>std::vector&lt;double&gt;residuals;
std::cout &lt;&lt; Print_res(std::cout);
std::ostream&amp; Print_res(std::ostream&amp; os) const {

  os &lt;&lt; "\tresidual" &lt;&lt; std::endl;
  for (unsigned int i = 0 ; i &lt; 22 ; i++) {
    os &lt;&lt; "\t\t" &lt;&lt; residuals[i] &lt;&lt; std::endl;
  }
  os &lt;&lt; std::flush;
  return os;
};
</code></pre>

<p>It prints the residuals correctly, but at the end of the output tags an address as follows:</p>

<pre><code>2275
2279.08
2224.0835
0x80c5604
</code></pre>

<p>how do I fix this?
EDIT: after reading everyone's comments I replaced the call to the function <code>Print_res</code> with a <code>std::copy</code> as</p>

<pre><code> std::copy(residuals.begin(), residuals.end(), std::ostream_iterator&lt;double&gt;(std::cout,"\n"));
</code></pre>

<p>and that did not print the address, so I presume there is something wrong in the way I have written the function.</p>
