| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 HashFunctions, | 71 HashFunctions, |
| 72 ValueTraits, | 72 ValueTraits, |
| 73 KeyTraits, | 73 KeyTraits, |
| 74 Allocator> | 74 Allocator> |
| 75 HashTableType; | 75 HashTableType; |
| 76 | 76 |
| 77 class HashMapKeysProxy; | 77 class HashMapKeysProxy; |
| 78 class HashMapValuesProxy; | 78 class HashMapValuesProxy; |
| 79 | 79 |
| 80 public: | 80 public: |
| 81 HashMap() { |
| 82 static_assert(Allocator::isGarbageCollected || |
| 83 !IsPointerToGarbageCollectedType<KeyArg>::value, |
| 84 "Cannot put raw pointers to garbage-collected classes into " |
| 85 "an off-heap HashMap. Use HeapHashMap<> instead."); |
| 86 static_assert(Allocator::isGarbageCollected || |
| 87 !IsPointerToGarbageCollectedType<MappedArg>::value, |
| 88 "Cannot put raw pointers to garbage-collected classes into " |
| 89 "an off-heap HashMap. Use HeapHashMap<> instead."); |
| 90 } |
| 91 |
| 81 typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; | 92 typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; |
| 82 typedef HashTableConstIteratorAdapter<HashTableType, ValueType> | 93 typedef HashTableConstIteratorAdapter<HashTableType, ValueType> |
| 83 const_iterator; | 94 const_iterator; |
| 84 typedef typename HashTableType::AddResult AddResult; | 95 typedef typename HashTableType::AddResult AddResult; |
| 85 | 96 |
| 86 public: | |
| 87 void swap(HashMap& ref) { m_impl.swap(ref.m_impl); } | 97 void swap(HashMap& ref) { m_impl.swap(ref.m_impl); } |
| 88 | 98 |
| 89 unsigned size() const; | 99 unsigned size() const; |
| 90 unsigned capacity() const; | 100 unsigned capacity() const; |
| 91 void reserveCapacityForSize(unsigned size) { | 101 void reserveCapacityForSize(unsigned size) { |
| 92 m_impl.reserveCapacityForSize(size); | 102 m_impl.reserveCapacityForSize(size); |
| 93 } | 103 } |
| 94 | 104 |
| 95 bool isEmpty() const; | 105 bool isEmpty() const; |
| 96 | 106 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 iterator end = collection.end().values(); | 700 iterator end = collection.end().values(); |
| 691 for (unsigned i = 0; it != end; ++it, ++i) | 701 for (unsigned i = 0; it != end; ++it, ++i) |
| 692 vector[i] = *it; | 702 vector[i] = *it; |
| 693 } | 703 } |
| 694 | 704 |
| 695 } // namespace WTF | 705 } // namespace WTF |
| 696 | 706 |
| 697 using WTF::HashMap; | 707 using WTF::HashMap; |
| 698 | 708 |
| 699 #endif // WTF_HashMap_h | 709 #endif // WTF_HashMap_h |
| OLD | NEW |