QMapmyMap; myMap.insert(1, "one"); myMap.insert(2, "two"); myMap.insert(3, "three"); myMap.remove(2); // removes the pair with key 2
QMapPackage library: The QMap class is part of the Qt library, which is a cross-platform development framework for C++. Therefore, you would need to include the necessary headers and link against the Qt libraries in order to use it.myMap; myMap.insert(1, "one"); myMap.insert(2, "two"); myMap.insert(3, "three"); auto it = myMap.find(2); // find the iterator of the item with key 2 if (it != myMap.end()) { myMap.erase(it); // removes the item pointed by the iterator }