dimanche 4 juin 2017

Using STL algorithms with Qt containers

I have a problem, using STL algorithm with QList: while executing it crashes. Debuger takes one more step into lambda, so before to crash entry is . (So, if list is empty is crashes at 1 iteration, if list has 1 element - at 2 iteration etc.).

void FindDialog::findEntries()
{
    QList<StudentEntry> searchResult;

    condition = [this] (const StudentEntry &entry) -> bool {
                // crashes here 
                return entry.name.getSurname() == surnameEdt1->text() &&
                       entry.group.getValue() == groupEdt->text();
                };

    std::copy_if(model->getStudentEntryList().begin(),
                 model->getStudentEntryList().end(),
                 searchResult.begin(),
                 condition);
}

How can I solve the problem?

Aucun commentaire:

Enregistrer un commentaire