title: Appending Temporary Vectors in One Line
body: <p>My goal is to fill a vector <code>v</code> with <code>1,1,1,2,2,2</code> (the length of the sequence is variable) by appending together two temporary vectors. I know that <a href="https://stackoverflow.com/questions/2551775/appending-a-vector-to-a-vector">this is possible</a>, however I was wondering if there is a one-liner solution.</p>
  <p>Here is the code I tried that did not work.</p>
  <pre><code>    int length = 3;
      vector&lt;int&gt; v(length, 1);//fill three 1s.
      v.insert(v.end(), vector(length, 2));//to fill three 2s, failed.
      for (size_t i = 0; i &lt; v.size(); i++)
      {
          cout &lt;&lt; v[i] &lt;&lt; &quot;, &quot;; // I want 1 1 1 2 2 2
      }
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/2551775/appending-a-vector-to-a-vector">Appending a vector to a vector</a></p>