I am not understanding how Insert works...
I am trying to insert a new element into my vector list as:
Code:
int n = 1;
std::vector<Player_Class>::iterator it;
it = PlayerList.begin();
PlayerList.insert(it+n, new Player_Class());
and it is giving me an error saying that the insert function is not overloaded to take the variables..
How would I insert new Player_Class() to the PlayerList vector at a specified position?
Ok, I think I miss understood how the vectors worked and they are not pointers to objects but that actual objects themselves. I am sure I understand now that if the vector was
Code:
std::Vector<Player_Class*> PlayerList
std::vector<Player_Class*>::iterator it;
Then it would work.
I just removed new and I am not even using this anymore because I realized that it's position was unnecessary anyway for what I need. I am just using PlayerList.push_back()