void erase(iterator pos) {
   // Save a pointer to the node
   _Node* __n = pos._current;
   // Remove the node from both the hash_map and the list
   _hash_map.erase(__n->_hmi);
   _list.erase(__n->_li);
   // Get rid of the node
   _node_allocator.destroy(__n);
   _node_allocator.deallocate(__n, 1);
}

Example 3: Implementation of erase().

Back to Article