I'm having trouble removing an object from the list according to a code.
I tried to do this:
void turma::removeraluno (int matricula){
// remover o aluno pelo codigo de matricula
list<aluno>::iterator it;
for (it=lista.begin();it != lista.end();it++){
if (it->getmatricula()== matricula) {
lista.erase(it);
} else{
cout << "NAO ENCONTRADO "<<endl;
}
}
But when I try to run the Memory Buffer error. I already tried with the remove too and it does not work