Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: Source/wtf/HashFunctions.h

Issue 835953003: Fix template angle bracket syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/wtf/HashCountedSet.h ('k') | Source/wtf/HashIterators.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key)); 131 return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key));
132 #if COMPILER(MSVC) 132 #if COMPILER(MSVC)
133 #pragma warning(pop) 133 #pragma warning(pop)
134 #endif 134 #endif
135 } 135 }
136 static bool equal(T a, T b) { return a == b; } 136 static bool equal(T a, T b) { return a == b; }
137 static bool equal(std::nullptr_t, T b) { return b == 0; } 137 static bool equal(std::nullptr_t, T b) { return b == 0; }
138 static bool equal(T a, std::nullptr_t) { return a == 0; } 138 static bool equal(T a, std::nullptr_t) { return a == 0; }
139 static const bool safeToCompareToEmptyOrDeleted = true; 139 static const bool safeToCompareToEmptyOrDeleted = true;
140 }; 140 };
141 template<typename P> struct PtrHash<RefPtr<P> > : PtrHash<P*> { 141 template<typename P> struct PtrHash<RefPtr<P>> : PtrHash<P*> {
142 using PtrHash<P*>::hash; 142 using PtrHash<P*>::hash;
143 static unsigned hash(const RefPtr<P>& key) { return hash(key.get()); } 143 static unsigned hash(const RefPtr<P>& key) { return hash(key.get()); }
144 static unsigned hash(const PassRefPtr<P>& key) { return hash(key.get()); } 144 static unsigned hash(const PassRefPtr<P>& key) { return hash(key.get()); }
145 using PtrHash<P*>::equal; 145 using PtrHash<P*>::equal;
146 static bool equal(const RefPtr<P>& a, const RefPtr<P>& b) { return a == b; } 146 static bool equal(const RefPtr<P>& a, const RefPtr<P>& b) { return a == b; }
147 static bool equal(P* a, const RefPtr<P>& b) { return a == b; } 147 static bool equal(P* a, const RefPtr<P>& b) { return a == b; }
148 static bool equal(const RefPtr<P>& a, P* b) { return a == b; } 148 static bool equal(const RefPtr<P>& a, P* b) { return a == b; }
149 static bool equal(const RefPtr<P>& a, const PassRefPtr<P>& b) { return a == b; } 149 static bool equal(const RefPtr<P>& a, const PassRefPtr<P>& b) { return a == b; }
150 }; 150 };
151 template<typename P> struct PtrHash<RawPtr<P> > : PtrHash<P*> { 151 template<typename P> struct PtrHash<RawPtr<P>> : PtrHash<P*> {
152 using PtrHash<P*>::hash; 152 using PtrHash<P*>::hash;
153 static unsigned hash(const RawPtr<P>& key) { return hash(key.get()); } 153 static unsigned hash(const RawPtr<P>& key) { return hash(key.get()); }
154 using PtrHash<P*>::equal; 154 using PtrHash<P*>::equal;
155 static bool equal(const RawPtr<P>& a, const RawPtr<P>& b) { return a == b; } 155 static bool equal(const RawPtr<P>& a, const RawPtr<P>& b) { return a == b; }
156 static bool equal(P* a, const RawPtr<P>& b) { return a == b; } 156 static bool equal(P* a, const RawPtr<P>& b) { return a == b; }
157 static bool equal(const RawPtr<P>& a, P* b) { return a == b; } 157 static bool equal(const RawPtr<P>& a, P* b) { return a == b; }
158 }; 158 };
159 template<typename P> struct PtrHash<OwnPtr<P> > : PtrHash<P*> { 159 template<typename P> struct PtrHash<OwnPtr<P>> : PtrHash<P*> {
160 using PtrHash<P*>::hash; 160 using PtrHash<P*>::hash;
161 static unsigned hash(const OwnPtr<P>& key) { return hash(key.get()); } 161 static unsigned hash(const OwnPtr<P>& key) { return hash(key.get()); }
162 static unsigned hash(const PassOwnPtr<P>& key) { return hash(key.get()); } 162 static unsigned hash(const PassOwnPtr<P>& key) { return hash(key.get()); }
163 163
164 static bool equal(const OwnPtr<P>& a, const OwnPtr<P>& b) 164 static bool equal(const OwnPtr<P>& a, const OwnPtr<P>& b)
165 { 165 {
166 return a.get() == b.get(); 166 return a.get() == b.get();
167 } 167 }
168 static bool equal(const OwnPtr<P>& a, P* b) { return a == b; } 168 static bool equal(const OwnPtr<P>& a, P* b) { return a == b; }
169 static bool equal(const OwnPtr<P>& a, const PassOwnPtr<P>& b) 169 static bool equal(const OwnPtr<P>& a, const PassOwnPtr<P>& b)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED) 209 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
210 template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; }; 210 template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; };
211 #endif 211 #endif
212 212
213 template<> struct DefaultHash<float> { typedef FloatHash<float> Hash; }; 213 template<> struct DefaultHash<float> { typedef FloatHash<float> Hash; };
214 template<> struct DefaultHash<double> { typedef FloatHash<double> Hash; }; 214 template<> struct DefaultHash<double> { typedef FloatHash<double> Hash; };
215 215
216 // make PtrHash the default hash function for pointer types that don't speci alize 216 // make PtrHash the default hash function for pointer types that don't speci alize
217 217
218 template<typename P> struct DefaultHash<P*> { typedef PtrHash<P*> Hash; }; 218 template<typename P> struct DefaultHash<P*> { typedef PtrHash<P*> Hash; };
219 template<typename P> struct DefaultHash<RefPtr<P> > { typedef PtrHash<RefPtr <P> > Hash; }; 219 template<typename P> struct DefaultHash<RefPtr<P>> { typedef PtrHash<RefPtr< P>> Hash; };
220 template<typename P> struct DefaultHash<RawPtr<P> > { typedef PtrHash<RawPtr <P> > Hash; }; 220 template<typename P> struct DefaultHash<RawPtr<P>> { typedef PtrHash<RawPtr< P>> Hash; };
221 template<typename P> struct DefaultHash<OwnPtr<P> > { typedef PtrHash<OwnPtr <P> > Hash; }; 221 template<typename P> struct DefaultHash<OwnPtr<P>> { typedef PtrHash<OwnPtr< P>> Hash; };
222 222
223 // make IntPairHash the default hash function for pairs of (at most) 32-bit integers. 223 // make IntPairHash the default hash function for pairs of (at most) 32-bit integers.
224 224
225 template<> struct DefaultHash<std::pair<short, short> > { typedef IntPairHas h<short, short> Hash; }; 225 template<> struct DefaultHash<std::pair<short, short>> { typedef IntPairHash <short, short> Hash; };
226 template<> struct DefaultHash<std::pair<short, unsigned short> > { typedef I ntPairHash<short, unsigned short> Hash; }; 226 template<> struct DefaultHash<std::pair<short, unsigned short>> { typedef In tPairHash<short, unsigned short> Hash; };
227 template<> struct DefaultHash<std::pair<short, int> > { typedef IntPairHash< short, int> Hash; }; 227 template<> struct DefaultHash<std::pair<short, int>> { typedef IntPairHash<s hort, int> Hash; };
228 template<> struct DefaultHash<std::pair<short, unsigned> > { typedef IntPair Hash<short, unsigned> Hash; }; 228 template<> struct DefaultHash<std::pair<short, unsigned>> { typedef IntPairH ash<short, unsigned> Hash; };
229 template<> struct DefaultHash<std::pair<unsigned short, short> > { typedef I ntPairHash<unsigned short, short> Hash; }; 229 template<> struct DefaultHash<std::pair<unsigned short, short>> { typedef In tPairHash<unsigned short, short> Hash; };
230 template<> struct DefaultHash<std::pair<unsigned short, unsigned short> > { typedef IntPairHash<unsigned short, unsigned short> Hash; }; 230 template<> struct DefaultHash<std::pair<unsigned short, unsigned short>> { t ypedef IntPairHash<unsigned short, unsigned short> Hash; };
231 template<> struct DefaultHash<std::pair<unsigned short, int> > { typedef Int PairHash<unsigned short, int> Hash; }; 231 template<> struct DefaultHash<std::pair<unsigned short, int>> { typedef IntP airHash<unsigned short, int> Hash; };
232 template<> struct DefaultHash<std::pair<unsigned short, unsigned> > { typede f IntPairHash<unsigned short, unsigned> Hash; }; 232 template<> struct DefaultHash<std::pair<unsigned short, unsigned>> { typedef IntPairHash<unsigned short, unsigned> Hash; };
233 template<> struct DefaultHash<std::pair<int, short> > { typedef IntPairHash< int, short> Hash; }; 233 template<> struct DefaultHash<std::pair<int, short>> { typedef IntPairHash<i nt, short> Hash; };
234 template<> struct DefaultHash<std::pair<int, unsigned short> > { typedef Int PairHash<int, unsigned short> Hash; }; 234 template<> struct DefaultHash<std::pair<int, unsigned short>> { typedef IntP airHash<int, unsigned short> Hash; };
235 template<> struct DefaultHash<std::pair<int, int> > { typedef IntPairHash<in t, int> Hash; }; 235 template<> struct DefaultHash<std::pair<int, int>> { typedef IntPairHash<int , int> Hash; };
236 template<> struct DefaultHash<std::pair<int, unsigned> > { typedef IntPairHa sh<unsigned, unsigned> Hash; }; 236 template<> struct DefaultHash<std::pair<int, unsigned>> { typedef IntPairHas h<unsigned, unsigned> Hash; };
237 template<> struct DefaultHash<std::pair<unsigned, short> > { typedef IntPair Hash<unsigned, short> Hash; }; 237 template<> struct DefaultHash<std::pair<unsigned, short>> { typedef IntPairH ash<unsigned, short> Hash; };
238 template<> struct DefaultHash<std::pair<unsigned, unsigned short> > { typede f IntPairHash<unsigned, unsigned short> Hash; }; 238 template<> struct DefaultHash<std::pair<unsigned, unsigned short>> { typedef IntPairHash<unsigned, unsigned short> Hash; };
239 template<> struct DefaultHash<std::pair<unsigned, int> > { typedef IntPairHa sh<unsigned, int> Hash; }; 239 template<> struct DefaultHash<std::pair<unsigned, int>> { typedef IntPairHas h<unsigned, int> Hash; };
240 template<> struct DefaultHash<std::pair<unsigned, unsigned> > { typedef IntP airHash<unsigned, unsigned> Hash; }; 240 template<> struct DefaultHash<std::pair<unsigned, unsigned>> { typedef IntPa irHash<unsigned, unsigned> Hash; };
241 241
242 // make PairHash the default hash function for pairs of arbitrary values. 242 // make PairHash the default hash function for pairs of arbitrary values.
243 243
244 template<typename T, typename U> struct DefaultHash<std::pair<T, U> > { type def PairHash<T, U> Hash; }; 244 template<typename T, typename U> struct DefaultHash<std::pair<T, U>> { typed ef PairHash<T, U> Hash; };
245 245
246 } // namespace WTF 246 } // namespace WTF
247 247
248 using WTF::DefaultHash; 248 using WTF::DefaultHash;
249 using WTF::IntHash; 249 using WTF::IntHash;
250 using WTF::PtrHash; 250 using WTF::PtrHash;
251 251
252 #endif // WTF_HashFunctions_h 252 #endif // WTF_HashFunctions_h
OLDNEW
« no previous file with comments | « Source/wtf/HashCountedSet.h ('k') | Source/wtf/HashIterators.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698