// Clears all the sub-elements of a given iterator, and then // removes it from 'sounds'. void clearAll(PtrMap::iterator it) { IDMap::iterator sit = it->second.begin(); while(sit != it->second.end()) { // Get sound pointer, if any SoundPtr snd = sit->second.lock(); // Stop the sound if(snd) snd->stop(); sit++; } // Remove the ptr reference sounds.erase(it); }