I have this code:
	
	
	
		
Breaking through the code in gdb yields this result:
for(int...)
for(iter...)
if(iter)
add to result[]
erase
for(iter...)
if(iter) (is not equal)
for(iter)
After that point, the program completely hangs. No errors or anything, just sits there. It should work, I use the same loop in several other methods with the same list.
	
		
			
		
		
	
				
			
		Code:
	
	/*!
 * Returns a list in order by descending priority 
 */
std::map<int, Task*> prioritizeListDesc(std::map<int, Task*> list)
{
    TodoListIterator iter;
    std::map<int, Task*> result;
    int priority = 5;
    
    for(int priority = 5; priority > 0; priority-- )
    {
        for(iter = list.begin(); iter != list.end(); iter++)
        {
            if(iter->second->getPriority() == priority)
            {
                result[iter->first] = iter->second;
                list.erase(iter);
            }
        }
    }
    
    return result;   
    
}Breaking through the code in gdb yields this result:
for(int...)
for(iter...)
if(iter)
add to result[]
erase
for(iter...)
if(iter) (is not equal)
for(iter)
After that point, the program completely hangs. No errors or anything, just sits there. It should work, I use the same loop in several other methods with the same list.
 
 
		