Changeset 12321 in webkit for trunk/JavaScriptCore/kxmlcore/HashTable.h
- Timestamp:
- Jan 23, 2006, 4:56:32 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kxmlcore/HashTable.h
r12301 r12321 285 285 int capacity() const { return m_tableSize; } 286 286 287 pair<iterator, bool> insert(const ValueType& value) { return insert<KeyType, ValueType, IdentityTranslatorType>(ExtractKey(value), value); }288 289 // A special version of insert() that finds the object by hashing and comparing287 pair<iterator, bool> add(const ValueType& value) { return add<KeyType, ValueType, IdentityTranslatorType>(ExtractKey(value), value); } 288 289 // A special version of add() that finds the object by hashing and comparing 290 290 // with some other type, to avoid the cost of type conversion if the object is already 291 291 // in the table. 292 template<typename T, typename Extra, typename HashTranslator> pair<iterator, bool> insert(const T& key, const Extra&);292 template<typename T, typename Extra, typename HashTranslator> pair<iterator, bool> add(const T& key, const Extra&); 293 293 294 294 iterator find(const KeyType&); … … 416 416 template<typename Key, typename Value, const Key& ExtractKey(const Value&), typename HashFunctions, typename Traits, typename KeyTraits> 417 417 template<typename T, typename Extra, typename HashTranslator> 418 inline pair<typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits, KeyTraits>::iterator, bool> HashTable<Key, Value, ExtractKey, HashFunctions, Traits, KeyTraits>:: insert(const T& key, const Extra &extra)418 inline pair<typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits, KeyTraits>::iterator, bool> HashTable<Key, Value, ExtractKey, HashFunctions, Traits, KeyTraits>::add(const T& key, const Extra &extra) 419 419 { 420 420 invalidateIterators(); … … 632 632 #endif 633 633 { 634 // Copy the hash table the dumb way, by inserting each element into the new table.634 // Copy the hash table the dumb way, by adding each element to the new table. 635 635 // It might be more efficient to copy the table slots, but it's not clear that efficiency is needed. 636 636 const_iterator end = other.end(); 637 637 for (const_iterator it = other.begin(); it != end; ++it) 638 insert(*it);638 add(*it); 639 639 } 640 640
Note:
See TracChangeset
for help on using the changeset viewer.