title: Understanding the code for std::move()
body: <p>I really want to understand the intrinsic details of the std::move() function.</p>
  
  <p>The code for std::move() as stated here: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2027.html#Move_Semantics" rel="nofollow">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2027.html#Move_Semantics</a>.</p>
  
  <pre><code>template &lt;class T&gt;
  typename remove_reference&lt;T&gt;::type&amp;&amp;
  move(T&amp;&amp; a)
  {
      return a;
  }
  </code></pre>
  
  <p>Why does this code return a rvalue reference? The parameter is a type T rvalue reference. Does <code>a</code> evaluate to the object pointed to by the rvalue reference, such that a rvalue reference is returned to the object? Also, why is the <code>remove_reference&lt;T&gt;</code> part required?</p>
  
  <p>The tutorial also writes </p>
  
  <blockquote>
    <p>This move() gives its target the value of its argument, but is not
    obliged to preserve the value of its source. So, for a vector, move()
    could reasonably be expected to leave its argument as a zero-capacity
    vector to avoid having to copy all the elements. In other words, move
    is a potentially destructive read.</p>
  </blockquote>
  
  <p>but then it is said that </p>
  
  <blockquote>
    <p>The move function really does very little work. All move does is
    accept either an lvalue or rvalue argument, and return it as an rvalue
    without triggering a copy construction.</p>
  </blockquote>
  
  <p>Should this be understood as, the std::move() could first "empty" the object (in this case a std::vector) and thereafter return the object as an rvalue (according to the C++ specification)? But, that the official std::move() does exactly as specified in the latter quote?</p>
  
  <p>And why is it said that std::move() returns a rvalue, when it returns a rvalue reference?</p>