C++ - Safety of accessing element of vector via pointers
问题 In a C++ project of mine, I am using a vector to hold a bunch of struct s which hold a number of elements for a simple game (ie: tic-tac-toe, coordinates, x vs o , etc). ie: struct gameMove { int x; int y; int player; int order; }; Every time during a single game, whenever a player makes a move (ie: places an x or o ), the information is stored in the vector via push_back() , to create an "undo" feature, which currently works as expected. In some parts of my undo/redo logic, I am using