title: Function return a tuple made of vectors
body: <p>I am trying avoid output arguments in my functions. The old function is:</p>
  
  <pre><code>void getAllBlockMeanError(
      const vector&lt;int&gt; &amp;vec, vector&lt;int&gt; &amp;fact, vector&lt;int&gt; &amp;mean, vector&lt;int&gt; &amp;err)
  </code></pre>
  
  <p>Here <code>vec</code> is input argument, <code>fact</code>, <code>mean</code> and <code>err</code> are output argument. I tried to group output argument to one tuple:</p>
  
  <pre><code>tuple&lt; vector&lt;int&gt;, vector&lt;int&gt;, vector&lt;int&gt; &gt; 
                                    getAllBlockMeanErrorTuple(const vector&lt;int&gt; &amp;vec)
  {
      vector&lt;int&gt; fact, mean, err;
      //....
      return make_tuple(fact, mean, err);
  }
  </code></pre>
  
  <p>Now I can call the new function with:</p>
  
  <pre><code>tie(fact, mean, err) = getAllBlockMeanErrorTuple(vec);
  </code></pre>
  
  <p>It looks cleaner to me. While I have a question, how does equal assignment of <code>tie(fact, mean, err)</code> work? Does it do a deep copy or a move? Since <code>fact</code>, <code>mean</code> and <code>err</code> inside <code>getAllBlockMeanErrorTuple</code> will be destroyed, I hope it is doing a move instead of a deep copy.</p>