August 2012
Intermediate to advanced
976 pages
30h 17m
English
The vector and string types provide members, described in Table 9.10, that let us interact with the memory-allocation part of the implementation. The capacity operation tells us how many elements the container can hold before it must allocate more space. The reserve operation lets us tell the container how many elements it should be prepared to hold.
Table 9.10. Container Size Management
Note
reserve does not change the number of elements in the container; it affects only how much memory the vector preallocates.
Read now
Unlock full access