title: C++: rvalue reference memory
body: <p>Since c++ provides references to rvalues i.e. rvalue references which are mainly used to perform move semantics and other memory efficient tasks. But in the following case reference is changing the value of an literal but as we know that literals are read only so how could a reference change the value of some read only variable. Does a rvalue reference allocate it's own memory or it simply changes the value of literal?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int a = 5;
      int&amp;&amp; b = 3;
      int&amp; c = a;
      b++;
      c++;
      cout &lt;&lt; " Value for b " &lt;&lt; b &lt;&lt; " Value for c " &lt;&lt; c &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Secondly, when a temporary object is assigned with a reference, reference works with the data of that object. But according to the definition of temporary objects they are deleted as when the expression using them ends. How could the reference act as an alias name to that temporary object if that temporary object is out of memory?</p>