title: std::vector and move constructible elements
body: <p>According to documentation, <code>std::vector</code> elements should be <a href="http://en.cppreference.com/w/cpp/concept/MoveInsertable" rel="nofollow noreferrer"><code>MoveInsertable</code></a> for <code>push_back</code> and <code>emplace_back</code>, in case the capacity needs to be increased.</p>
  
  <p>However in the example below the <em>copy</em> constructor is used during resizing, even though class <code>A</code> has a move constructor. If I <code>delete</code> the copy constructor, only then the move constructor is used.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  struct A
  {
      A() { std::cout &lt;&lt; "creating A\n"; }
      A(const A&amp; that) { std::cout &lt;&lt; "copying A\n"; }
      A(A&amp;&amp;that) { std::cout &lt;&lt; "moving A\n"; }
  };
  
  int main()
  {
      std::vector&lt;A&gt; vec;
      std::cout &lt;&lt; "size=" &lt;&lt; vec.size() &lt;&lt; ", capacity=" &lt;&lt; vec.capacity() &lt;&lt; "\n";
      vec.emplace_back();
      std::cout &lt;&lt; "size=" &lt;&lt; vec.size() &lt;&lt; ", capacity=" &lt;&lt; vec.capacity() &lt;&lt; "\n";
      for (size_t i = vec.size(), n = vec.capacity() + 1; i &lt; n; i++) {
          vec.emplace_back();
      }
      std::cout &lt;&lt; "size=" &lt;&lt; vec.size() &lt;&lt; ", capacity=" &lt;&lt; vec.capacity() &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>Output
  </p>
  
  <pre class="lang-none prettyprint-override"><code>size=0, capacity=0
  creating A
  size=1, capacity=1
  creating A
  copying A
  size=2, capacity=2
  </code></pre>
  
  <p>The question is - shouldn't <code>std::vector</code> prefer my move constructor over the copy constructor?</p>