mySongs
is a vector that store a collection of songs input by the user. In the if statement, the program will check the elements in the vector with user input. If match, it will delete that specified value from the vector. When I look for the solution, I see someone recommend to use remove/erase idiom:. But when I implement in my code, it continue pop up this error C2678 binary '==': no operator found which takes a left - hand operand of type 'Song' (or there is no acceptable conversion)
void deleteSong() {
string songTitle;
cout << "\n\t\tPlease enter the particular song name to remove: ";
cin >> songTitle;
if (songTitle != "") {
for (Song songs : mySongs) {
if (songs.title == songTitle) {
mySongs.erase(find(mySongs.begin, mySongs.end, songs)); //erase an element with value
break;
}
}
}
}