diff options
Diffstat (limited to 'core/ordered_hash_map.h')
| -rw-r--r-- | core/ordered_hash_map.h | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/core/ordered_hash_map.h b/core/ordered_hash_map.h index 9e95f963e1..1ed5a5d369 100644 --- a/core/ordered_hash_map.h +++ b/core/ordered_hash_map.h @@ -93,8 +93,12 @@ public: return *this; } - friend bool operator==(const Element &, const Element &); - friend bool operator!=(const Element &, const Element &); + _FORCE_INLINE_ bool operator==(const Element &p_other) const { + return this->list_element == p_other.list_element; + } + _FORCE_INLINE_ bool operator!=(const Element &p_other) const { + return this->list_element != p_other.list_element; + } operator bool() const { return (list_element != NULL); @@ -157,8 +161,12 @@ public: return ConstElement(list_element ? list_element->prev() : NULL); } - friend bool operator==(const ConstElement &, const ConstElement &); - friend bool operator!=(const ConstElement &, const ConstElement &); + _FORCE_INLINE_ bool operator==(const ConstElement &p_other) const { + return this->list_element == p_other.list_element; + } + _FORCE_INLINE_ bool operator!=(const ConstElement &p_other) const { + return this->list_element != p_other.list_element; + } operator bool() const { return (list_element != NULL); @@ -181,7 +189,7 @@ public: }; ConstElement find(const K &p_key) const { - typename InternalList::Element **list_element = map.getptr(p_key); + typename InternalList::Element *const *list_element = map.getptr(p_key); if (list_element) { return ConstElement(*list_element); } @@ -288,28 +296,4 @@ public: } }; -template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP> -bool operator==(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &first, - const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &second) { - return (first.list_element == second.list_element); -} - -template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP> -bool operator!=(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &first, - const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &second) { - return (first.list_element != second.list_element); -} - -template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP> -bool operator==(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &first, - const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &second) { - return (first.list_element == second.list_element); -} - -template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP> -bool operator!=(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &first, - const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &second) { - return (first.list_element != second.list_element); -} - #endif // ORDERED_HASH_MAP_H |
