I can't seem to figure how should i rewrite this piece of code using find_if, I would also like to hear if there are any advantages in doing that
const Movie& MovieRepo::find(const string& title,const string& genre,const string& star,const int year) const {
for (const auto& m : all) {
if (m.getTitle() == title && m.getGenre() == genre && m.getStar() == star && m.getYear() == year) {
return m;
}
}
throw MovieRepoException("Error find");
}
Aucun commentaire:
Enregistrer un commentaire