I cannot seem to figure out how to pass by reference my vector of pointers. I think I am doing it right and I have tried searching google/ the forums, but I am at a loss.
Here is my code
So that should basically be a vector of pointers to objects that are gamestates if I did that correctly.Code:std::vector<baseGameState*> States;
States.push_back(new MENU_STATE);
In that part of the code I go to the most current vector and run it while passing States. But I am not sure if I am passing it as a reference or is it being copied.(If I try run(&States) it gives me an error message)Code:if ((active && States.back()->run(States)) || keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signalled A Quit
}
And this is what gets the reference I think, But I cannot seem to be able to push anything in the class.Code:int run(std::vector<baseGameState*>& States){
update();
render();
return 0;
};
Can someone help me?