I have this code above where I push_back numbers to 3 elements.Code:std::vector<int> PutNumbers; PutNumbers.push_back(1); PutNumbers.push_back(2); PutNumbers.push_back(3); //Result PutNumbers = 1; PutNumbers = 2; PutNumbers = 3;
I am reading these numbers from a file but when I will read the fourth number wich could be 4 I want to replace the vector so it will look like below.
I know I can do this manually by iterate trough the elements etc.. This is not a problem.
But I wonder if there is any function for this for the std::vector to easy achive this. I have searched around but havn´t found anything about that subject.
Code:PutNumbers.push_back(4); //Result PutNumbers = 2; PutNumbers = 3; PutNumbers = 4;