|
|
@@ -96,38 +96,10 @@ public:
|
|
|
return (*this + -value);
|
|
|
}
|
|
|
|
|
|
- difference_type operator-(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return other.index - index;
|
|
|
- }
|
|
|
-
|
|
|
[[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
|
|
|
return *operator+(value);
|
|
|
}
|
|
|
|
|
|
- [[nodiscard]] bool operator==(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return other.index == index;
|
|
|
- }
|
|
|
-
|
|
|
- [[nodiscard]] bool operator!=(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return !(*this == other);
|
|
|
- }
|
|
|
-
|
|
|
- [[nodiscard]] bool operator<(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return index > other.index;
|
|
|
- }
|
|
|
-
|
|
|
- [[nodiscard]] bool operator>(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return index < other.index;
|
|
|
- }
|
|
|
-
|
|
|
- [[nodiscard]] bool operator<=(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return !(*this > other);
|
|
|
- }
|
|
|
-
|
|
|
- [[nodiscard]] bool operator>=(const storage_iterator &other) const ENTT_NOEXCEPT {
|
|
|
- return !(*this < other);
|
|
|
- }
|
|
|
-
|
|
|
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
|
|
|
const auto pos = index - 1;
|
|
|
return (*packed)[pos / packed_page_v] + fast_mod(pos, packed_page_v);
|
|
|
@@ -137,11 +109,50 @@ public:
|
|
|
return *operator->();
|
|
|
}
|
|
|
|
|
|
+ [[nodiscard]] difference_type base() const ENTT_NOEXCEPT {
|
|
|
+ return index;
|
|
|
+ }
|
|
|
+
|
|
|
private:
|
|
|
Container *packed;
|
|
|
difference_type index;
|
|
|
};
|
|
|
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] auto operator-(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return rhs.base() - lhs.base();
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator==(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return lhs.base() == rhs.base();
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator!=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return !(lhs == rhs);
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator<(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return lhs.base() > rhs.base();
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator>(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return lhs.base() < rhs.base();
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator<=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return !(lhs > rhs);
|
|
|
+}
|
|
|
+
|
|
|
+template<typename CLhs, typename CRhs>
|
|
|
+[[nodiscard]] bool operator>=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
|
|
|
+ return !(lhs < rhs);
|
|
|
+}
|
|
|
+
|
|
|
} // namespace internal
|
|
|
|
|
|
/**
|