Beispiel #1
0
inline void MoveEvents::clearMap(MoveListMap& map)
{
    for(MoveListMap::iterator it = map.begin(); it != map.end(); ++it)
    {
        for(int32_t i = MOVE_EVENT_FIRST; i <= MOVE_EVENT_LAST; ++i)
        {
            EventList& moveEventList = it->second.moveEvent[i];
            for(EventList::iterator it = moveEventList.begin(); it != moveEventList.end(); ++it)
                delete (*it);

            moveEventList.clear();
        }
    }

    map.clear();
}
void MoveEvents::clearMap(MoveListMap& map)
{
	std::unordered_set<MoveEvent*> set;
	for (const auto& it : map) {
		const MoveEventList& moveEventList = it.second;
		for (int32_t i = 0; i < MOVE_EVENT_LAST; ++i) {
			for (MoveEvent* moveEvent : moveEventList.moveEvent[i]) {
				set.insert(moveEvent);
			}
		}
	}
	map.clear();

	for (MoveEvent* moveEvent : set) {
		delete moveEvent;
	}
}
Beispiel #3
0
void MoveEvents::clearMap(MoveListMap& map)
{
    std::unordered_set<MoveEvent*> set;
    for (const auto& it : map) {
        const MoveEventList& moveEventList = it.second;
        for (const auto& i : moveEventList.moveEvent) {
            for (MoveEvent* moveEvent : i) {
                set.insert(moveEvent);
            }
        }
    }
    map.clear();

    for (MoveEvent* moveEvent : set) {
        delete moveEvent;
    }
}