Changeset 17664 in webkit for trunk/JavaScriptCore/wtf/HashMap.h


Ignore:
Timestamp:
Nov 8, 2006, 1:20:26 PM (19 years ago)
Author:
adachan
Message:

2006-11-08 Ada Chan <[email protected]>

Reviewed by darin.


Added a method to delete all the keys in a HashMap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/HashMap.h

    r17127 r17664  
    321321    }
    322322
     323    template<typename KeyType, typename HashTableType>
     324    void deleteAllPairFirsts(HashTableType& collection)
     325    {
     326        typedef typename HashTableType::const_iterator iterator;
     327        iterator end = collection.end();
     328        for (iterator it = collection.begin(); it != end; ++it)
     329            delete *(KeyType*)&it->first;
     330    }
     331
     332    template<typename T, typename U, typename V, typename W, typename X>
     333    inline void deleteAllKeys(const HashMap<T, U, V, W, X>& collection)
     334    {
     335        deleteAllPairFirsts<typename HashMap<T, U, V, W, X>::KeyType>(collection);
     336    }
     337
    323338} // namespace WTF
    324339
Note: See TracChangeset for help on using the changeset viewer.