(留坑待填)

 Extraction from the C++ Programming Language 4th. ed., Bjarne Stroustrup

31.3.3 Size and Capacity

The size is the number of elements in the container; the capacity is the number of elements that a container can hold before allocating more memory.

When changing the size or the capacity, the elements may be moved to new locations. That implies that iterators (and pointers and references) to elements may become invalid (i.e., point to the old element locations).

 

相关文章: