Hi all,
I came across some vector problem recently. Below is my code.
std::vector<int> MyBuffer(10);
for(int i=0;i<10;i++)
MyBuffer.push_back(i);//First 10 elements are zero and after index 10 i getting stored.
Why the behaviour if like this if i provide size during Declaration.
I want to know what will be the difference if I declare in the following method.
std::vector<int> MyBuffer;
MyBuffer.reserve(10);