title: Using of rvalue references in c++11
body: <p>I would like to implement a function that fills up a vector and then returns an rvalue reference. I tired something like:</p>
  
  <pre><code>std::vector&lt;int&gt; &amp;&amp;fill_list() {
    std::vector&lt;int&gt; res;
    ... do something to fill res ...
    return res;
  }
  
  int main(int argc, char **argv) {
    std::vector&lt;int&gt; myvec = fill_list();
    return 0;
  }
  </code></pre>
  
  <p>but that doesn't work, I get the following error:</p>
  
  <pre><code>error: invalid initialization of reference of type 'std::vector&lt;int&gt;&amp;&amp;' from expression of type 'std::vector&lt;int&gt;'
  </code></pre>
  
  <p>So, all in all, how is the right way of doing it? I don't think I get rvalue references just yet.</p>