I noticed that when the else if statement is being executed in this code destination, despite not being dereferenced, seems to be interpreted as the actual value it is pointing to instead of the iterator. It's like it's being automatically dereferenced. The for loop executes as you would expect, but id like done to be set to true when the begin() and end() iterators are equal. destinations is a deque of integers, global to this function.
void removeDestination(int destinationFloor)
{
    bool done = false;
    while(!done && !destinations.empty())
    {
        for (auto destination = destinations.begin(); destination != destinations.end(); ++destination)
        {
            if(*destination == destinationFloor)
            {
                destinations.erase(destination);
                break;
            }
            else if(destination == destinations.end())
            {
                done = true;
            }
        }
    }
}
Thanks for the help.
 
     
     
     
    