OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> | 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 template <typename T, typename U> | 726 template <typename T, typename U> |
727 static bool equal(const T& a, const U& b) { | 727 static bool equal(const T& a, const U& b) { |
728 return HashFunctions::equal(a->m_value, b); | 728 return HashFunctions::equal(a->m_value, b); |
729 } | 729 } |
730 template <typename T, typename U, typename V> | 730 template <typename T, typename U, typename V> |
731 static void translate(T*& location, U&& key, const V& allocator) { | 731 static void translate(T*& location, U&& key, const V& allocator) { |
732 location = new (const_cast<V*>(&allocator)) T(std::forward<U>(key)); | 732 location = new (const_cast<V*>(&allocator)) T(std::forward<U>(key)); |
733 } | 733 } |
734 }; | 734 }; |
735 | 735 |
736 template <typename T, size_t inlineCapacity, typename U, typename V> | 736 template <typename T, size_t inlineCapacity, typename U, typename Allocator> |
737 inline ListHashSet<T, inlineCapacity, U, V>::ListHashSet() | 737 inline ListHashSet<T, inlineCapacity, U, Allocator>::ListHashSet() |
738 : m_head(nullptr), m_tail(nullptr) {} | 738 : m_head(nullptr), m_tail(nullptr) { |
| 739 static_assert( |
| 740 Allocator::isGarbageCollected || |
| 741 !IsPointerToGarbageCollectedType<T>::value, |
| 742 "Cannot put raw pointers to garbage-collected classes into " |
| 743 "an off-heap ListHashSet. Use HeapListHashSet<Member<T>> instead."); |
| 744 } |
739 | 745 |
740 template <typename T, size_t inlineCapacity, typename U, typename V> | 746 template <typename T, size_t inlineCapacity, typename U, typename V> |
741 inline ListHashSet<T, inlineCapacity, U, V>::ListHashSet( | 747 inline ListHashSet<T, inlineCapacity, U, V>::ListHashSet( |
742 const ListHashSet& other) | 748 const ListHashSet& other) |
743 : m_head(nullptr), m_tail(nullptr) { | 749 : m_head(nullptr), m_tail(nullptr) { |
744 const_iterator end = other.end(); | 750 const_iterator end = other.end(); |
745 for (const_iterator it = other.begin(); it != end; ++it) | 751 for (const_iterator it = other.begin(); it != end; ++it) |
746 add(*it); | 752 add(*it); |
747 } | 753 } |
748 | 754 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 // through the HashTable. That includes m_head and m_tail so we do not have | 1107 // through the HashTable. That includes m_head and m_tail so we do not have |
1102 // to explicitly trace them here. | 1108 // to explicitly trace them here. |
1103 m_impl.trace(visitor); | 1109 m_impl.trace(visitor); |
1104 } | 1110 } |
1105 | 1111 |
1106 } // namespace WTF | 1112 } // namespace WTF |
1107 | 1113 |
1108 using WTF::ListHashSet; | 1114 using WTF::ListHashSet; |
1109 | 1115 |
1110 #endif // WTF_ListHashSet_h | 1116 #endif // WTF_ListHashSet_h |
OLD | NEW |