1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-10-05 19:16:54 +08:00
This commit is contained in:
Arthur O'Dwyer 2023-09-02 17:41:29 -06:00 committed by GitHub
commit 846583ad4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -194,21 +194,18 @@ class small_map {
} }
} }
inline bool operator==(const iterator& other) const { friend bool operator==(const iterator& a, const iterator& b) {
if (array_iter_ != NULL) { if (a.array_iter_ != NULL) {
return array_iter_ == other.array_iter_; return a.array_iter_ == b.array_iter_;
} else { } else {
return other.array_iter_ == NULL && hash_iter_ == other.hash_iter_; return b.array_iter_ == NULL && a.hash_iter_ == b.hash_iter_;
} }
} }
inline bool operator!=(const iterator& other) const { friend bool operator!=(const iterator& a, const iterator& b) {
return !(*this == other); return !(a == b);
} }
bool operator==(const const_iterator& other) const;
bool operator!=(const const_iterator& other) const;
private: private:
friend class small_map; friend class small_map;
friend class const_iterator; friend class const_iterator;
@ -277,16 +274,16 @@ class small_map {
} }
} }
inline bool operator==(const const_iterator& other) const { friend bool operator==(const const_iterator& a, const const_iterator& b) {
if (array_iter_ != NULL) { if (a.array_iter_ != NULL) {
return array_iter_ == other.array_iter_; return a.array_iter_ == b.array_iter_;
} else { } else {
return other.array_iter_ == NULL && hash_iter_ == other.hash_iter_; return b.array_iter_ == NULL && a.hash_iter_ == b.hash_iter_;
} }
} }
inline bool operator!=(const const_iterator& other) const { friend bool operator!=(const const_iterator& a, const const_iterator& b) {
return !(*this == other); return !(a == b);
} }
private: private:
@ -549,21 +546,6 @@ class small_map {
} }
}; };
template <typename NormalMap, int kArraySize, typename EqualKey,
typename Functor>
inline bool small_map<NormalMap, kArraySize, EqualKey,
Functor>::iterator::operator==(
const const_iterator& other) const {
return other == *this;
}
template <typename NormalMap, int kArraySize, typename EqualKey,
typename Functor>
inline bool small_map<NormalMap, kArraySize, EqualKey,
Functor>::iterator::operator!=(
const const_iterator& other) const {
return other != *this;
}
} }
#endif // UTIL_GTL_SMALL_MAP_H_ #endif // UTIL_GTL_SMALL_MAP_H_