title: c++: function lvalue or rvalue
body: <p>I just started learning about rvalue references in c++11 by reading <a href="http://thbecker.net/articles/rvalue_references/section_01.html" rel="noreferrer">this page</a>, but I got stuck into the very first page. Here is the code I took from that page. </p>
  
  <pre><code>  int&amp; foo();
    foo() = 42; // ok, foo() is an lvalue
    int* p1 = &amp;foo(); // ok, foo() is an lvalue
  
    int foobar();
    j = foobar(); // ok, foobar() is an rvalue
    int* p2 = &amp;foobar(); // error, cannot take the address of an rvalue
  </code></pre>
  
  <ol>
  <li>why is <code>foo()</code> an lvalue? is it because <code>foo()</code> returns <code>int&amp;</code> which is basically an lvalue?</li>
  <li>why is <code>foobar()</code> an rvalue? is it because <code>foobar()</code> returns <code>int</code>?</li>
  <li>In general, why would you care if a function is an rvalue or not? I think if I read the rest of that article, I'll get my answer to this.</li>
  </ol>