Doubt regarding v.capacity()

we can not predetermine the value of the capacity? it is upto the compiler or can we calculate it by ourself?

It’s nothing like that, if you have an empty vector, you push one element in vector it’s size become 1 & capacity 2;
you push 5 element in vector it’s size become 5 & capacity 8;
That is capacity increases with power of 2 whenever it reaches it’s limit.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.