Changeset 12329 in webkit for trunk/JavaScriptCore/kxmlcore/HashFunctions.h
- Timestamp:
- Jan 23, 2006, 11:31:21 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kxmlcore/HashFunctions.h
r12301 r12329 63 63 return key; 64 64 } 65 66 template<> struct DefaultHash<void *> { 67 static unsigned hash(void *key) { return pointerHash<sizeof(void *)>(key); } 68 static bool equal(void *a, void *b) { return a == b; } 69 }; 70 71 // pointer identity hash - default for void *, must be requested explicitly for other 72 // pointer types; also should work for integer types 73 template<typename T> struct PointerHash { 65 66 // pointer identity hash - default for pointer types that don't 67 // explicitly specialize otherwise; also should work for integer 68 // types 69 template<typename T> struct PtrHash { 74 70 static unsigned hash(T key) { return pointerHash<sizeof(void *)>((void *)key); } 75 71 static bool equal(T a, T b) { return a == b; } 76 72 }; 77 73 78 template<typename P> struct P ointerHash<RefPtr<P> > {74 template<typename P> struct PtrHash<RefPtr<P> > { 79 75 static unsigned hash(const RefPtr<P>& key) { return pointerHash<sizeof(void *)>((void *)key.get()); } 80 76 static bool equal(const RefPtr<P>& a, const RefPtr<P>& b) { return a == b; } 77 }; 78 79 template<typename P> struct DefaultHash<P *> { 80 typedef PtrHash<P *> Hash; 81 }; 82 83 template<> struct DefaultHash<int> { 84 typedef PtrHash<int> Hash; 81 85 }; 82 86 … … 84 88 85 89 using KXMLCore::DefaultHash; 86 using KXMLCore::P ointerHash;90 using KXMLCore::PtrHash; 87 91 88 92 #endif // KXLMCORE_HASH_FUNCTIONS_H
Note:
See TracChangeset
for help on using the changeset viewer.