Why compiler warns about implicit conversion in setprecision?
<p>When I compile the following code, compiler gives me the warning: </p>

<pre><code>"Implicit conversion loses integer precision: 'std::streamsize' (aka 'long') to 'int'". 
</code></pre>

<p>I'm a little bit confused about this warning since I just try to save the current value of the precision to set it back to the original value later.</p>

<pre><code>#include &lt;iomanip&gt;
#include &lt;iostream&gt;

int main() {
  std::streamsize prec = std::cout.precision();
  std::cout &lt;&lt; std::setprecision(prec);
}
</code></pre>

<p>What is the right way to save the precision value and set it back later in this case?</p>
