I have a custom data structure Class Client and ClientList.
In ClientList I do
map<ULONG, Client*> list;
and then I add elements by
void ClientList::add(Client *client) {
list.insert(std::pair<ULONG,Client*>(client->getID(),client));
}
how to check if insert fails?
map::insert returns a
pair< iterator, bool >where theboolindicates if the item has been inserted or if the key is already present in the list. If the key is already present, the iterator will point to this item.