Game Development Reference
In-Depth Information
Both of these containers are excellent at storing sets of data that you plan to access in a linear
fashion as the data is stored together in memory. They do have some drawbacks, however. The
array container cannot be resized, which means you need to know at compile time how many
elements you would like to store. The vector stores its data internally inside an array. When you add
elements and the vector requires more room it will create another array, usually double the size of
the current array and copy all of the elements from the old array to the new array. In the next chapter
we will look at another linear STL container, the List, which can be used when you need to add and
remove elements to a linear collection often without having to worry about the resize performance
required by a vector.
Search WWH ::




Custom Search