Homework/HW05/HashTable.cc
bool HashTable::remove(WordCounter &wordc, string k, int position)
{
    if (!isValid(position))
        return false;
    else 
    {
        ListIter iter = storage[position].begin();
        while (iter != storage[position].end() && 
               key(*iter) != k)
            ++iter;
        if (iter == storage[position].end())
            return false;
        else 
        {
            wordc = *iter;
            storage[position].erase(iter);
            numObjects--;
            return true;
        }
    }
}
// This private function removes the word counter object from the list
// at the given position. It is also intended to be called internally
// because public remove function should determine the position based
// on the hash function before it calls this one. They key is used to
// locate the object which is copied to the object wordc before it is
// erased.
This private function removes the word counter object from the list
at the given position. It is also intended to be called internally
because public remove function should determine the position based
on the hash function before it calls this one. They key is used to
locate the object which is copied to the object wordc before it is
erased.
This private function removes the word counter object from the list at the given position . It is also intended to be called internally because public remove function should determine the position based on the hash function before it calls this one . They key is used to locate the object which is copied to the object wordc before it is erased .
bool HashTable::remove(WordCounter &wordc, string k, int position)
{
    if (!isValid(position))
        return false;
    else 
    {
        ListIter iter = storage[position].begin();
        while (iter != storage[position].end() && 
               key(*iter) != k)
            ++iter;
        if (iter == storage[position].end())
            return false;
        else 
        {
            wordc = *iter;
            storage[position].erase(iter);
            numObjects--;
            return true;
        }
    }
}
bool HashTable :: remove ( WordCounter & wordc , string k , int position ) { if ( ! isValid ( position ) ) return false ; else { ListIter iter = storage [ position ] . begin ( ) ; while ( iter != storage [ position ] . end ( ) && key ( * iter ) != k ) ++ iter ; if ( iter == storage [ position ] . end ( ) ) return false ; else { wordc = * iter ; storage [ position ] . erase ( iter ) ; numObjects -- ; return true ; } } }
This private function removes the word counter object from the list
at the given position.
This private function removes the word counter object from the list at the given position .