Changeset 24059 in webkit for trunk/JavaScriptCore/wtf/HashSet.h
- Timestamp:
- Jul 6, 2007, 5:09:08 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/HashSet.h
r21494 r24059 103 103 }; 104 104 105 template<bool canReplaceDeletedValue, typename ValueType, typename StorageTraits, typename HashFunctions>105 template<bool canReplaceDeletedValue, typename ValueType, typename ValueTraits, typename StorageTraits, typename HashFunctions> 106 106 struct HashSetTranslator; 107 107 108 template<typename ValueType, typename StorageTraits, typename HashFunctions>109 struct HashSetTranslator<true, ValueType, StorageTraits, HashFunctions> {108 template<typename ValueType, typename ValueTraits, typename StorageTraits, typename HashFunctions> 109 struct HashSetTranslator<true, ValueType, ValueTraits, StorageTraits, HashFunctions> { 110 110 typedef typename StorageTraits::TraitType StorageType; 111 111 static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); } … … 113 113 static void translate(StorageType& location, const ValueType& key, const ValueType&, unsigned) 114 114 { 115 *(ValueType*)&location = key;115 Assigner<ValueTraits::needsRef, ValueType, StorageType, ValueTraits>::assign(key, location); 116 116 } 117 117 }; 118 118 119 template<typename ValueType, typename StorageTraits, typename HashFunctions>120 struct HashSetTranslator<false, ValueType, StorageTraits, HashFunctions> {119 template<typename ValueType, typename ValueTraits, typename StorageTraits, typename HashFunctions> 120 struct HashSetTranslator<false, ValueType, ValueTraits, StorageTraits, HashFunctions> { 121 121 typedef typename StorageTraits::TraitType StorageType; 122 122 static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); } … … 126 126 if (location == StorageTraits::deletedValue()) 127 127 location = StorageTraits::emptyValue(); 128 *(ValueType*)&location = key;128 Assigner<ValueTraits::needsRef, ValueType, StorageType, ValueTraits>::assign(key, location); 129 129 } 130 130 }; … … 265 265 { 266 266 const bool canReplaceDeletedValue = !ValueTraits::needsDestruction || StorageTraits::needsDestruction; 267 typedef HashSetTranslator<canReplaceDeletedValue, ValueType, StorageTraits, HashFunctions> Translator;267 typedef HashSetTranslator<canReplaceDeletedValue, ValueType, ValueTraits, StorageTraits, HashFunctions> Translator; 268 268 return m_impl.template add<ValueType, ValueType, Translator>(value, value); 269 269 }
Note:
See TracChangeset
for help on using the changeset viewer.