I want to check if there are structures with the same values in the vector array. May someone explain to me how should I do this?
struct mineCoordinate{
int x;
int y;
};
std::vector<mineCoordinate> mines; // vector array
if(std::find(mines.begin(), mines.end(), mineCoordinate{userInputX,userInputY}) != mines.end()) {
//do something if true.}
As you can see I tried std::find function, and I think it should work ( this is the answer to most of these questions like mine). The only condition was to compare the same objects