title: How string pop_back is implemented in constant time?
body: <p><code>std::string pop_back()</code> : Remove the last element of the string </p>
  
  <p>In the C++ specification it is said that the C++11 string class function pop_back has a constant time complexity. </p>
  
  <p>(to be more precise - Unspecified but generally constant)</p>
  
  <p><a href="http://www.cplusplus.com/reference/string/string/pop_back/" rel="nofollow">http://www.cplusplus.com/reference/string/string/pop_back/</a> </p>
  
  <p>Apart from that I read the draft of C++11 specification and it is said that <code>pop_back</code> is equal to <code>str.erase(str.length() -1)</code>. As far as I know the erase function simply allocates a new amount of memory and copies the remaining elements (not deleted) to this memory which will take up to linear time. In the light of this how can the pop_back finish in constant time.</p>