Ah, now I understand. You want to avoid concurent modification exception. Now I look more closely to whole Terminator design and I think that cleaner object way is to create singleton object that is own type ( so not map ), with proper destructor and forwarding methods to inner map. Then you can introduce states so something like ( pseudocode )
```
class ExternalWidgetsFactory
{
  private:
    map<..> holder;
    destroy_state = false;
  public:
    get(name); //this is in fact YExternalWidgets* YExternalWidgets::externalWidgets(const std::string& name) method
   delete_callback(name) { if(!destroy_state) holder.erase(name) }
}
```
and create one static instance of this class.

benefits:
- one static object with API
- no magic Terminator living outside of map
- more intuitive design with Factory pattern