OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. |
3 * | 4 * |
4 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
8 * | 9 * |
9 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 13 * Library General Public License for more details. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 storage = std::move(value); | 241 storage = std::move(value); |
241 } | 242 } |
242 | 243 |
243 using PeekOutType = T*; | 244 using PeekOutType = T*; |
244 static PeekOutType peek(const std::unique_ptr<T>& value) { | 245 static PeekOutType peek(const std::unique_ptr<T>& value) { |
245 return value.get(); | 246 return value.get(); |
246 } | 247 } |
247 static PeekOutType peek(std::nullptr_t) { return nullptr; } | 248 static PeekOutType peek(std::nullptr_t) { return nullptr; } |
248 | 249 |
249 static void constructDeletedValue(std::unique_ptr<T>& slot, bool) { | 250 static void constructDeletedValue(std::unique_ptr<T>& slot, bool) { |
250 // Dirty trick: implant an invalid pointer to unique_ptr. Destructor isn't c
alled for deleted buckets, | 251 // Dirty trick: implant an invalid pointer to unique_ptr. Destructor isn't |
251 // so this is okay. | 252 // called for deleted buckets, so this is okay. |
252 new (NotNull, &slot) std::unique_ptr<T>(reinterpret_cast<T*>(1u)); | 253 new (NotNull, &slot) std::unique_ptr<T>(reinterpret_cast<T*>(1u)); |
253 } | 254 } |
254 static bool isDeletedValue(const std::unique_ptr<T>& value) { | 255 static bool isDeletedValue(const std::unique_ptr<T>& value) { |
255 return value.get() == reinterpret_cast<T*>(1u); | 256 return value.get() == reinterpret_cast<T*>(1u); |
256 } | 257 } |
257 }; | 258 }; |
258 | 259 |
259 template <> | 260 template <> |
260 struct HashTraits<String> : SimpleClassHashTraits<String> { | 261 struct HashTraits<String> : SimpleClassHashTraits<String> { |
261 static const bool hasIsEmptyValueFunction = true; | 262 static const bool hasIsEmptyValueFunction = true; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 struct TraceInCollectionTrait; | 433 struct TraceInCollectionTrait; |
433 | 434 |
434 } // namespace WTF | 435 } // namespace WTF |
435 | 436 |
436 using WTF::HashTraits; | 437 using WTF::HashTraits; |
437 using WTF::PairHashTraits; | 438 using WTF::PairHashTraits; |
438 using WTF::NullableHashTraits; | 439 using WTF::NullableHashTraits; |
439 using WTF::SimpleClassHashTraits; | 440 using WTF::SimpleClassHashTraits; |
440 | 441 |
441 #endif // WTF_HashTraits_h | 442 #endif // WTF_HashTraits_h |
OLD | NEW |