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
void ListCoordSelecter::deSelect(const Located& loc)
{
QLinkedList<Located>::iterator iter = this->list.begin();
while (iter.i->n != NULL)
{
if (iter.reference.x() == loc.x() && iter.reference.y == loc.y())
{
//remove the element pointed by iterator
break; //end of loop
}
}
}
void ListCoordSelecter::deSelect(const Located& loc)
{
QLinkedList<Located>::iterator iter = this->list.begin();
while (iter.i->n != NULL)
{
if (iter.reference.x() == loc.x() && iter.reference.y == loc.y())
{
//remove the element pointed by iterator
break; //end of loop
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks