title: C++11 - what does it mean to initialize a variable to a reference
body: <pre><code>#include&lt;vector&gt;
  using namespace std;
  
  class Foo
  {
    private:
      vector&lt;int&gt; m_vec;
    public:
      vector&lt;int&gt; getFoo()
      {
        return m_vec; // returns a copy of m_vec
      }
      vector&lt;int&gt;&amp; getFooRef()
      {
        return m_vec; // returns a reference of m_vec
      }
  };
  
  int main()
  {
    Foo foo;
    vector&lt;int&gt; x = foo.getFoo(); // init x with a copy of m_vec
    vector&lt;int&gt;&amp; y = foo.getFooRef(); // y is a reference to foo.m_vec - no new copy is created
    vector&lt;int&gt; z = foo.getFooRef(); // what happens here?? Is the copy constructor invoked?
    vector&lt;int&gt;&amp; a = foo.getFoo(); // what happens here?? Is `a` a reference to a copy of m_vec?
    return 0;
  }
  </code></pre>