Well some STL containers have a resize() function which will either make the container larger or discard elements and force it to be smaller. Examples are vector and deque. However, these containers also automatically grow and shrink as items are added and/or removed.