C++ STL notes
Vector
reserve()
andresize()
are differentreserve()
change the capacity of the vector can hold, has no effect on the current items/does not change the size of the vector- Need to use
push_back()
to add elements instead of using[]
access
- Need to use
resize()
change the actual size of the vector, inserting default values to the vector, thus can use[]
to modify