I must agree with jlou. Post more relevant code. Step through the code when you for the first time pushes to the vector and see it both values are the same. You are probably changing visible_pointlights or entities->pointlight values and not updating the corresponding datastructure. They must work synchronized or else it will not work. Remember that std::vector objects are stored as copies!