So I'm trying to write a clone of Space invader using SFML and everything was going fine until I tried to delete from a couple of vectors, now I'm getting an error telling me that the assignment operator has been implicitly deleted. I've tried lots of different things but can't seem to get rid of this error. As I understand the assignment operator is deleted when you declare another user created one which I haven't done.. That I know of. I've tried searching all over for how to fix this but everything I've found doesn't help. How would one go about fixing this?
This is where I'm trying to remove from the vector
1 2 3 4 5 6 7 8 9 10
void Game_Screen::shot_collision(int index){
for (int i = 0; i < shield.size(); i++){
if (shots[index].getX() == shield[i].getX()){
if (shots[index].getY() == shield[i].getY() + 1 || shots[index].getY() == shield[i].getY()){
shots.erase(shots.begin() + index);
shield.erase(shield.begin() + i);
}
}
}
}
Which just caused more errors for me. I saw on stack overflow someone said to just use a std::list instead which wouldn't suit my needs for me or a std::set which also seems like it just wouldn't suit my needs.
Yes that's fixed it! Thanks a ton mate.
I am curious though, why exactly would not having my constants set to static make the copy assignment operators of both the classes be implicitly deleted?