auto MyName = "Luffy";
for (auto &student: students)
{
if (student.name == MyName)
{
m_student_info = &student;
}
}
students is a struct with names and rollnumbers declared somewhere with values. How do I improve this piece of code inside a constructor? return cannot be used inside the constructor. even when student.name finds a match, it still continues to run in loop, how to avoid that?
Aucun commentaire:
Enregistrer un commentaire