title: Why does std::vector::insert need to copy assign?
body: <p>I was trying to understand the following behaviour:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iterator&gt;    
  
  struct Foo {
      Foo(int a) : a_ {a} {}
      const int a_; // Note the const
  };
  
  int main(int argc, char **argv) {
      std::vector&lt;Foo&gt; v1 {Foo {0}};
      std::vector&lt;Foo&gt; v2 {Foo {1}};
  
      auto first = std::begin(v2);
      auto last  = std::end(v2);
  
      for (; first != last; ++first) {
          v1.push_back(*first); // Fine
      }
  
      //v1.insert(v1.begin(), first, last); // Does not compile
  
      return 0;
  }
  </code></pre>
  
  <p>It turns out the <code>const</code> member of <code>Foo</code> was implicitly deleting <code>Foo</code>s copy-assignment operator, which <code>std::vector::insert</code> used.</p>
  
  <p>Why does <code>std::vector::insert</code> need to copy assign while <code>std::vector::push_back</code> copy constructs? Does this mean it can be more efficient to manually concatenate two vectors? This is using LLVM.</p>