QListmylist = {10, 20, 30, 40, 50}; mylist.erase(mylist.begin() + 2); // Remove element at position 2 (30) // mylist now contains {10, 20, 40, 50}
QListmylist = {10, 20, 30, 40, 50}; mylist.erase(mylist.begin() + 1, mylist.end() - 2); // Remove elements from position 1 to end-2 // mylist now contains {10, 50}
QListThe `QList` class is part of the Qt Core library.mylist = {10, 20, 30, 10, 50}; mylist.erase(std::remove(mylist.begin(), mylist.end(), 10), mylist.end()); // Remove all occurrences of 10 // mylist now contains {20, 30, 50}