Q:

Is there a push back time limit for vector

For c++ STL we can insert new value by using "push_back", is there a push_back times limit if we never pop_back? 
In other words, what is the maximum size of vector? 
Because when declare vector, we don't need to specify the size of vector, so I am not sure the  maximum size of vector. 
Thanks. 
I just print out v.max_size(), it is 9223372036854775807 in xcode, I think this is the size limit.  

A:

std::vector::max_size() returns the maximum number of elements that the vector can hold.  However, it is not guaranteed that the vector will be able to grow to that size.  To quote from http://www.cplusplus.com/reference/vector/vector/max_size/ :

This is the maximum potential size the container can reach due to known system or library implementation limitations, but the container is by no means guaranteed to be able to reach that size: it can still fail to allocate storage at any point before that size is reached

