I'm the developer of open source project https://github.com/amreo/gridb
I want to implement the deSelect function in src/listcoordselecter.cpp

How to fast way to find and remove item?

I want to find the iterator and remove the related element like
Qt Code:
  1. void ListCoordSelecter::deSelect(const Located& loc)
  2. {
  3. QLinkedList<Located>::iterator iter = this->list.begin();
  4.  
  5. while (iter.i->n != NULL)
  6. {
  7. if (iter.reference.x() == loc.x() && iter.reference.y == loc.y())
  8. {
  9. //remove the element pointed by iterator
  10. break; //end of loop
  11. }
  12. }
  13. }
To copy to clipboard, switch view to plain text mode