In C++, will the vector function push_back increase the size of an empty array?
Quick question. Let's say I declare a vector of size 20. And then I want to add a few integers to it using push_back. vector<int> myVector(20); myVector.push_back(5); myVector.push_back(14); Is the capacity of my vector now 22, or is it still 20? Were 5 and 14 added to indices [19] and [20], respectively? Or are they at [0] and [1]? After those statements its capacity is implementation-defined. (Please note that is different from its size.) vector<int> myVector(20); This creates a vector filled with twenty 0's. Its size is twenty, exactly, and its capacity is at least twenty. Whether or not it