title: return a vector vs use a parameter for the vector to return it
body: <p>With the code below, the question is:<br>
  <br>
  If you use the "returnIntVector()" function, is the vector copied from the local to the "outer" (global) scope? In other words is it a <strong>more time and memory consuming</strong> variation compared to the "getIntVector()"-function? (However providing the same functionality.)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  vector&lt;int&gt; returnIntVector()
  {
     vector&lt;int&gt; vecInts(10);
     for(unsigned int ui = 0; ui &lt; vecInts.size(); ui++)
        vecInts[ui] = ui;
  
     return vecInts;
  }
  
  void getIntVector(vector&lt;int&gt; &amp;vecInts)
  {
     for(unsigned int ui = 0; ui &lt; vecInts.size(); ui++)
        vecInts[ui] = ui;
  }
  
  int main()
  {
     vector&lt;int&gt; vecInts = returnIntVector();
     for(unsigned int ui = 0; ui &lt; vecInts.size(); ui++)
        cout &lt;&lt; vecInts[ui] &lt;&lt; endl;
     cout &lt;&lt; endl;
  
     vector&lt;int&gt; vecInts2(10);
     getIntVector(vecInts2);
     for(unsigned int ui = 0; ui &lt; vecInts2.size(); ui++)
        cout &lt;&lt; vecInts2[ui] &lt;&lt; endl;
  
     return 0;
  }
  </code></pre>