title: How are rvalues in c++ stored in memory?
body: <p>Trying to learn <code>lvalues</code>, <code>rvalues</code> and memory allocation for them. So with a lot of learning materials there is a bit of chaos.</p>
  
  <p>An <code>rvalue</code> is a value that needs to exist only in bounds of a expression where it was created (until C++11 at least). So it has an address and block of memory that it occupies. But by definition we cannot get an address of <code>rvalue</code>, because it is a temporary object in contrast to an <code>lvalue</code>.
  But even before C++11 we were able to get an address of <code>rvalue</code> by returning it from a function and saving it into a const reference type (uh, I guess not an address but a value).</p>
  
  <p>So, more precisely, how does <code>rvalue</code> allocation work? For how long does the program or OS really remember that place of memory where the <code>rvalue</code> was created and marked as allocated and another object cannot take its place?</p>
  
  <p>How I see it, now <code>rvalues</code> are stored just like <code>lvalues</code> but we simply have other rights to access them. And they have other types of deallocation - for <code>lvalues</code> going out of scope, for <code>rvalues</code> may be optimized by existence in bounds of expression or until there is no more links to it.</p>