title: What happens when I assign a temporary int to a const reference in C++?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2784262/does-a-const-reference-prolong-the-life-of-a-temporary">Does a const reference prolong the life of a temporary?</a>  </p>
  </blockquote>
  
  
  
  <p>let say that I have a function  <code>f</code>:</p>
  
  
  
  <pre><code>int f(int x){return x;}
  
  const int &amp;a=f(1);
  </code></pre>
  
  <p>I know that <code>f(1)</code> is just a temporary and i will be destroyed after this statement, but</p>
  
  <ol>
  <li>does making the reference const will give f(1) a long life ?</li>
  <li>if yes, where <code>f(1)</code> is gonna be stored ?</li>
  <li>and is that mean that <code>x</code> also did not get destroyed when it run out of scope?</li>
  <li>what is the difference between <code>f(1)</code> and <code>x</code>?</li>
  </ol>