1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-09-28 19:05:49 +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 {
if (array_iter_ != NULL) {
return array_iter_ == other.array_iter_;
friend bool operator==(const iterator& a, const iterator& b) {
if (a.array_iter_ != NULL) {
return a.array_iter_ == b.array_iter_;
} 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 {
return !(*this == other);
friend bool operator!=(const iterator& a, const iterator& b) {
return !(a == b);
}
bool operator==(const const_iterator& other) const;
bool operator!=(const const_iterator& other) const;
private:
friend class small_map;
friend class const_iterator;
@ -277,16 +274,16 @@ class small_map {
}
}
inline bool operator==(const const_iterator& other) const {
if (array_iter_ != NULL) {
return array_iter_ == other.array_iter_;
friend bool operator==(const const_iterator& a, const const_iterator& b) {
if (a.array_iter_ != NULL) {
return a.array_iter_ == b.array_iter_;
} 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 {
return !(*this == other);
friend bool operator!=(const const_iterator& a, const const_iterator& b) {
return !(a == b);
}
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_