*: revert unnecessary changes ¯\_(ツ)_/¯

This commit is contained in:
Michele Caini
2021-10-20 12:18:18 +02:00
parent b625ff0902
commit efaa3f9e55
4 changed files with 70 additions and 105 deletions

View File

@@ -76,8 +76,12 @@ public:
return *operator->();
}
[[nodiscard]] iterator_type base() const ENTT_NOEXCEPT {
return it;
[[nodiscard]] bool operator==(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
return it == other.it;
}
[[nodiscard]] bool operator!=(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}
private:
@@ -87,16 +91,6 @@ private:
bool no_tombstone_check;
};
template<typename Type>
[[nodiscard]] bool operator==(const runtime_view_iterator<Type> &lhs, const runtime_view_iterator<Type> &rhs) ENTT_NOEXCEPT {
return lhs.base() == rhs.base();
}
template<typename Type>
[[nodiscard]] bool operator!=(const runtime_view_iterator<Type> &lhs, const runtime_view_iterator<Type> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
} // namespace internal
/**

View File

@@ -85,8 +85,32 @@ struct sparse_set_iterator final {
return *operator->();
}
[[nodiscard]] difference_type base() const ENTT_NOEXCEPT {
return index;
[[nodiscard]] difference_type operator-(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return other.index - index;
}
[[nodiscard]] bool operator==(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return index == other.index;
}
[[nodiscard]] bool operator!=(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}
[[nodiscard]] bool operator<(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return index > other.index;
}
[[nodiscard]] bool operator>(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return index < other.index;
}
[[nodiscard]] bool operator<=(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return !(*this > other);
}
[[nodiscard]] bool operator>=(const sparse_set_iterator &other) const ENTT_NOEXCEPT {
return !(*this < other);
}
private:
@@ -94,41 +118,6 @@ private:
difference_type index;
};
template<typename Container>
[[nodiscard]] auto operator-(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return rhs.base() - lhs.base();
}
template<typename Container>
[[nodiscard]] bool operator==(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return lhs.base() == rhs.base();
}
template<typename Container>
[[nodiscard]] bool operator!=(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
template<typename Container>
[[nodiscard]] bool operator<(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return lhs.base() > rhs.base();
}
template<typename Container>
[[nodiscard]] bool operator>(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return lhs.base() < rhs.base();
}
template<typename Container>
[[nodiscard]] bool operator<=(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return !(lhs > rhs);
}
template<typename Container>
[[nodiscard]] bool operator>=(const sparse_set_iterator<Container> &lhs, const sparse_set_iterator<Container> &rhs) ENTT_NOEXCEPT {
return !(lhs < rhs);
}
} // namespace internal
/**

View File

@@ -1536,6 +1536,24 @@ public:
return static_cast<bool>(handle);
}
/**
* @brief Checks if two iterators refer to the same element.
* @param other The iterator with which to compare.
* @return True if the iterators refer to the same element, false otherwise.
*/
[[nodiscard]] bool operator==(const meta_iterator &other) const ENTT_NOEXCEPT {
return handle == other.handle;
}
/**
* @brief Checks if two iterators refer to the same element.
* @param other The iterator with which to compare.
* @return False if the iterators refer to the same element, true otherwise.
*/
[[nodiscard]] bool operator!=(const meta_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}
/**
* @brief Returns the underlying iterator.
* @return The underlying iterator.
@@ -1549,26 +1567,6 @@ private:
any handle{};
};
/**
* @brief Checks if two iterators refer to the same element.
* @param lhs An iterator to compare.
* @param rhs An iterator with which to compare.
* @return True if the iterators refer to the same element, false otherwise.
*/
[[nodiscard]] inline bool operator==(const typename meta_sequence_container::iterator &lhs, const typename meta_sequence_container::iterator &rhs) ENTT_NOEXCEPT {
return lhs.base() == rhs.base();
}
/**
* @brief Checks if two iterators refer to the same element.
* @param lhs An iterator to compare.
* @param rhs An iterator with which to compare.
* @return False if the iterators refer to the same element, true otherwise.
*/
[[nodiscard]] inline bool operator!=(const typename meta_sequence_container::iterator &lhs, const typename meta_sequence_container::iterator &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
/**
* @brief Returns the meta value type of a container.
* @return The meta value type of the container.
@@ -1746,11 +1744,21 @@ public:
}
/**
* @brief Returns the underlying iterator.
* @return The underlying iterator.
* @brief Checks if two iterators refer to the same element.
* @param other The iterator with which to compare.
* @return True if the iterators refer to the same element, false otherwise.
*/
any base() const ENTT_NOEXCEPT {
return handle.as_ref();
[[nodiscard]] bool operator==(const meta_iterator &other) const ENTT_NOEXCEPT {
return handle == other.handle;
}
/**
* @brief Checks if two iterators refer to the same element.
* @param other The iterator with which to compare.
* @return False if the iterators refer to the same element, true otherwise.
*/
[[nodiscard]] bool operator!=(const meta_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}
private:
@@ -1758,26 +1766,6 @@ private:
any handle{};
};
/**
* @brief Checks if two iterators refer to the same element.
* @param lhs An iterator to compare.
* @param rhs An iterator with which to compare.
* @return True if the iterators refer to the same element, false otherwise.
*/
[[nodiscard]] inline bool operator==(const typename meta_associative_container::iterator &lhs, const typename meta_associative_container::iterator &rhs) ENTT_NOEXCEPT {
return lhs.base() == rhs.base();
}
/**
* @brief Checks if two iterators refer to the same element.
* @param lhs An iterator to compare.
* @param rhs An iterator with which to compare.
* @return False if the iterators refer to the same element, true otherwise.
*/
[[nodiscard]] inline bool operator!=(const typename meta_associative_container::iterator &lhs, const typename meta_associative_container::iterator &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
/**
* @brief Returns true if a container is also key-only, false otherwise.
* @return True if the associative container is also key-only, false otherwise.

View File

@@ -45,24 +45,18 @@ struct meta_range_iterator {
return operator*();
}
[[nodiscard]] const node_type *base() const ENTT_NOEXCEPT {
return it;
[[nodiscard]] bool operator==(const meta_range_iterator &other) const ENTT_NOEXCEPT {
return it == other.it;
}
[[nodiscard]] bool operator!=(const meta_range_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}
private:
node_type *it{};
};
template<typename Type, typename Node>
[[nodiscard]] bool operator==(const meta_range_iterator<Type, Node> &lhs, const meta_range_iterator<Type, Node> &rhs) ENTT_NOEXCEPT {
return lhs.base() == rhs.base();
}
template<typename Type, typename Node>
[[nodiscard]] bool operator!=(const meta_range_iterator<Type, Node> &lhs, const meta_range_iterator<Type, Node> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
} // namespace internal
/**