Find next element in a QList with QMutableListIterator : QList « Qt « C++






Find next element in a QList with QMutableListIterator

  
#include <QtCore>
#include <QDebug>

int main() {
  QList<int> intlist;
  intlist << 2 << 5 << 2 << 4 << 2;

  QMutableListIterator<int> mit(intlist);

  while (mit.findNext(2))
    mit.remove();
  qDebug() << intlist; // output: (5, 4)
  return 0;
}

   
    
  








Related examples in the same category

1.Add int to QList
2.Append and insert into QList
3.Foreach loop with QList
4.Sorting QList
5.QList of QString
6.Delete all elements in a QList
7.Filling Data Structures
8.Quick sort QList
9.QList of int