diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-07-19 14:34:50 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-09-04 10:41:01 (GMT) |
commit | 24fd67c58f7df76df570f5f7f3e28c007381da7d (patch) | |
tree | 85aaf51bb251034f260dbcb84067bd2218a32f26 | |
parent | f6d448c52caf8f2ad411bd41e5c7e787cf57ef20 (diff) | |
download | Qt-24fd67c58f7df76df570f5f7f3e28c007381da7d.zip Qt-24fd67c58f7df76df570f5f7f3e28c007381da7d.tar.gz Qt-24fd67c58f7df76df570f5f7f3e28c007381da7d.tar.bz2 |
Work around an apparent xlC 7 bug: partial specialisation on HashMap.
This problem was appearing only in the functions in the HashMap
partial specialisation for Ref<T> that returned std::pair<iterator,
bool>.
"/pulse/qt/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h", line 205.5: 1540-1174 (S) The member "template std::pair<HashMap<RefPtr<T>,U,V,W,X>::iterator,bool> inlineAdd(const KeyType &, const MappedType &)" is not declared as a template in its containing class definition.
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h | 103 |
1 files changed, 54 insertions, 49 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h index 08f1619..b3ccd3a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h @@ -42,7 +42,7 @@ namespace WTF { }; template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> { + class RefPtrHashMap { private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; @@ -67,7 +67,7 @@ namespace WTF { typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator; - void swap(HashMap&); + void swap(RefPtrHashMap&); int size() const; int capacity() const; @@ -115,118 +115,123 @@ namespace WTF { HashTableType m_impl; }; + template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> + class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : + public RefPtrHashMap<T, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> + { + }; template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other) + inline void RefPtrHashMap<T, U, V, W, X>::swap(RefPtrHashMap& other) { m_impl.swap(other.m_impl); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::size() const + inline int RefPtrHashMap<T, U, V, W, X>::size() const { return m_impl.size(); } template<typename T, typename U, typename V, typename W, typename X> - inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const + inline int RefPtrHashMap<T, U, V, W, X>::capacity() const { return m_impl.capacity(); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const + inline bool RefPtrHashMap<T, U, V, W, X>::isEmpty() const { return m_impl.isEmpty(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::begin() { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end() + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::end() { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::begin() const { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::end() const { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) + inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) const { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const + inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) const { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(const KeyType& key) const { return m_impl.contains(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const + inline bool RefPtrHashMap<T, U, V, W, X>::contains(RawKeyType key) const { return m_impl.template contains<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); -// typename HashMap<RefPtr<T>, U, V, W, X>::iterator temp = p.first; - return make_pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>( - typename HashMap<RefPtr<T>, U, V, W, X>::iterator(p.first), p.second); +// typename RefPtrHashMap<T, U, V, W, X>::iterator temp = p.first; + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); // return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) + inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) { pair<typename HashTableType::iterator, bool> p = m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); - return make_pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>( - typename HashMap<RefPtr<T>, U, V, W, X>::iterator(p.first), p.second); + return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( + typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); // return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -237,8 +242,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -249,22 +254,22 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> - HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) + pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> + RefPtrHashMap<T, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key); if (!entry) @@ -273,8 +278,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + inline RefPtrHashMap<T, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<RawKeyType, RawKeyTranslator>(key); if (!entry) @@ -283,14 +288,14 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::get(RawKeyType key) const { return inlineGet(key); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it) + inline void RefPtrHashMap<T, U, V, W, X>::remove(iterator it) { if (it.m_impl == m_impl.end()) return; @@ -299,45 +304,45 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(const KeyType& key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key) + inline void RefPtrHashMap<T, U, V, W, X>::remove(RawKeyType key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void HashMap<RefPtr<T>, U, V, W, X>::clear() + inline void RefPtrHashMap<T, U, V, W, X>::clear() { m_impl.clear(); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType - HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key) + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType + RefPtrHashMap<T, U, V, W, MappedTraits>::take(RawKeyType key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; + typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } |