1
I’m having trouble removing an object from the list according to a code.
I tried to do so:
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 execute the error of memory buffer. I’ve tried with remove too and it doesn’t work
Thus ai gave the following error : error: no match for ?Operator[]' (operand types are ?Std::__cxx11::list<pupil>' and ?int')|
– gabriel