entity: iterator constexpr-ness review (close #883)

This commit is contained in:
Michele Caini
2022-05-04 16:18:37 +02:00
parent 96804b0b28
commit d8e5a97ef3
6 changed files with 92 additions and 92 deletions

View File

@@ -43,7 +43,7 @@ public:
using reference = value_type;
using iterator_category = std::input_iterator_tag;
extended_group_iterator()
constexpr extended_group_iterator()
: it{},
pools{} {}
@@ -69,7 +69,7 @@ public:
}
template<typename... Lhs, typename... Rhs>
friend bool operator==(const extended_group_iterator<Lhs...> &, const extended_group_iterator<Rhs...> &) ENTT_NOEXCEPT;
friend constexpr bool operator==(const extended_group_iterator<Lhs...> &, const extended_group_iterator<Rhs...> &) ENTT_NOEXCEPT;
private:
It it;
@@ -77,12 +77,12 @@ private:
};
template<typename... Lhs, typename... Rhs>
[[nodiscard]] bool operator==(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
return lhs.it == rhs.it;
}
template<typename... Lhs, typename... Rhs>
[[nodiscard]] bool operator!=(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const extended_group_iterator<Lhs...> &lhs, const extended_group_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}

View File

@@ -50,109 +50,109 @@ public:
using difference_type = std::ptrdiff_t;
using iterator_category = std::input_iterator_tag;
storage_proxy_iterator() ENTT_NOEXCEPT
constexpr storage_proxy_iterator() ENTT_NOEXCEPT
: it{} {}
storage_proxy_iterator(const It iter) ENTT_NOEXCEPT
constexpr storage_proxy_iterator(const It iter) ENTT_NOEXCEPT
: it{iter} {}
template<typename Other, typename = std::enable_if_t<!std::is_same_v<It, Other> && std::is_constructible_v<It, Other>>>
storage_proxy_iterator(const storage_proxy_iterator<Other> &other) ENTT_NOEXCEPT
constexpr storage_proxy_iterator(const storage_proxy_iterator<Other> &other) ENTT_NOEXCEPT
: it{other.it} {}
storage_proxy_iterator &operator++() ENTT_NOEXCEPT {
constexpr storage_proxy_iterator &operator++() ENTT_NOEXCEPT {
return ++it, *this;
}
storage_proxy_iterator operator++(int) ENTT_NOEXCEPT {
constexpr storage_proxy_iterator operator++(int) ENTT_NOEXCEPT {
storage_proxy_iterator orig = *this;
return ++(*this), orig;
}
storage_proxy_iterator &operator--() ENTT_NOEXCEPT {
constexpr storage_proxy_iterator &operator--() ENTT_NOEXCEPT {
return --it, *this;
}
storage_proxy_iterator operator--(int) ENTT_NOEXCEPT {
constexpr storage_proxy_iterator operator--(int) ENTT_NOEXCEPT {
storage_proxy_iterator orig = *this;
return operator--(), orig;
}
storage_proxy_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
constexpr storage_proxy_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
it += value;
return *this;
}
storage_proxy_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
constexpr storage_proxy_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
storage_proxy_iterator copy = *this;
return (copy += value);
}
storage_proxy_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
constexpr storage_proxy_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
return (*this += -value);
}
storage_proxy_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
constexpr storage_proxy_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
return (*this + -value);
}
[[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
return {it[value].first, *it[value].second};
}
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
return {it->first, *it->second};
}
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
return operator*();
}
template<typename ILhs, typename IRhs>
friend std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
friend constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
template<typename ILhs, typename IRhs>
friend bool operator==(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
friend constexpr bool operator==(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
template<typename ILhs, typename IRhs>
friend bool operator<(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
friend constexpr bool operator<(const storage_proxy_iterator<ILhs> &, const storage_proxy_iterator<IRhs> &) ENTT_NOEXCEPT;
private:
It it;
};
template<typename ILhs, typename IRhs>
[[nodiscard]] std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return lhs.it - rhs.it;
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator==(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return lhs.it == rhs.it;
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator!=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator<(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator<(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return lhs.it < rhs.it;
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator>(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator>(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return rhs < lhs;
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator<=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator<=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return !(lhs > rhs);
}
template<typename ILhs, typename IRhs>
[[nodiscard]] bool operator>=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator>=(const storage_proxy_iterator<ILhs> &lhs, const storage_proxy_iterator<IRhs> &rhs) ENTT_NOEXCEPT {
return !(lhs < rhs);
}

View File

@@ -37,7 +37,7 @@ public:
using reference = typename iterator_type::reference;
using iterator_category = std::bidirectional_iterator_tag;
runtime_view_iterator() ENTT_NOEXCEPT
constexpr runtime_view_iterator() ENTT_NOEXCEPT
: pools{},
filter{},
it{},
@@ -81,11 +81,11 @@ public:
return *operator->();
}
[[nodiscard]] bool operator==(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
[[nodiscard]] constexpr 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 {
[[nodiscard]] constexpr bool operator!=(const runtime_view_iterator &other) const ENTT_NOEXCEPT {
return !(*this == other);
}

View File

@@ -32,63 +32,63 @@ struct sparse_set_iterator final {
using difference_type = typename Container::difference_type;
using iterator_category = std::random_access_iterator_tag;
sparse_set_iterator() ENTT_NOEXCEPT
constexpr sparse_set_iterator() ENTT_NOEXCEPT
: packed{},
offset{} {}
sparse_set_iterator(const Container &ref, const difference_type idx) ENTT_NOEXCEPT
constexpr sparse_set_iterator(const Container &ref, const difference_type idx) ENTT_NOEXCEPT
: packed{std::addressof(ref)},
offset{idx} {}
sparse_set_iterator &operator++() ENTT_NOEXCEPT {
constexpr sparse_set_iterator &operator++() ENTT_NOEXCEPT {
return --offset, *this;
}
sparse_set_iterator operator++(int) ENTT_NOEXCEPT {
constexpr sparse_set_iterator operator++(int) ENTT_NOEXCEPT {
sparse_set_iterator orig = *this;
return ++(*this), orig;
}
sparse_set_iterator &operator--() ENTT_NOEXCEPT {
constexpr sparse_set_iterator &operator--() ENTT_NOEXCEPT {
return ++offset, *this;
}
sparse_set_iterator operator--(int) ENTT_NOEXCEPT {
constexpr sparse_set_iterator operator--(int) ENTT_NOEXCEPT {
sparse_set_iterator orig = *this;
return operator--(), orig;
}
sparse_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
constexpr sparse_set_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
offset -= value;
return *this;
}
sparse_set_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
constexpr sparse_set_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
sparse_set_iterator copy = *this;
return (copy += value);
}
sparse_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
constexpr sparse_set_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
return (*this += -value);
}
sparse_set_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
constexpr sparse_set_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
return (*this + -value);
}
[[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
return packed->data()[index() - value];
}
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
return packed->data() + index();
}
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
return *operator->();
}
[[nodiscard]] difference_type index() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr difference_type index() const ENTT_NOEXCEPT {
return offset - 1;
}
@@ -98,37 +98,37 @@ private:
};
template<typename Type, typename Other>
[[nodiscard]] std::ptrdiff_t operator-(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr std::ptrdiff_t operator-(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return rhs.index() - lhs.index();
}
template<typename Type, typename Other>
[[nodiscard]] bool operator==(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return lhs.index() == rhs.index();
}
template<typename Type, typename Other>
[[nodiscard]] bool operator!=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
template<typename Type, typename Other>
[[nodiscard]] bool operator<(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator<(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return lhs.index() > rhs.index();
}
template<typename Type, typename Other>
[[nodiscard]] bool operator>(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator>(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return lhs.index() < rhs.index();
}
template<typename Type, typename Other>
[[nodiscard]] bool operator<=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator<=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return !(lhs > rhs);
}
template<typename Type, typename Other>
[[nodiscard]] bool operator>=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator>=(const sparse_set_iterator<Type> &lhs, const sparse_set_iterator<Other> &rhs) ENTT_NOEXCEPT {
return !(lhs < rhs);
}

View File

@@ -48,68 +48,68 @@ public:
using difference_type = typename iterator_traits::difference_type;
using iterator_category = std::random_access_iterator_tag;
storage_iterator() ENTT_NOEXCEPT = default;
constexpr storage_iterator() ENTT_NOEXCEPT = default;
storage_iterator(Container *ref, difference_type idx) ENTT_NOEXCEPT
constexpr storage_iterator(Container *ref, difference_type idx) ENTT_NOEXCEPT
: packed{ref},
offset{idx} {}
template<bool Const = std::is_const_v<Container>, typename = std::enable_if_t<Const>>
storage_iterator(const storage_iterator<std::remove_const_t<Container>> &other) ENTT_NOEXCEPT
constexpr storage_iterator(const storage_iterator<std::remove_const_t<Container>> &other) ENTT_NOEXCEPT
: packed{other.packed},
offset{other.offset} {}
storage_iterator &operator++() ENTT_NOEXCEPT {
constexpr storage_iterator &operator++() ENTT_NOEXCEPT {
return --offset, *this;
}
storage_iterator operator++(int) ENTT_NOEXCEPT {
constexpr storage_iterator operator++(int) ENTT_NOEXCEPT {
storage_iterator orig = *this;
return ++(*this), orig;
}
storage_iterator &operator--() ENTT_NOEXCEPT {
constexpr storage_iterator &operator--() ENTT_NOEXCEPT {
return ++offset, *this;
}
storage_iterator operator--(int) ENTT_NOEXCEPT {
constexpr storage_iterator operator--(int) ENTT_NOEXCEPT {
storage_iterator orig = *this;
return operator--(), orig;
}
storage_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
constexpr storage_iterator &operator+=(const difference_type value) ENTT_NOEXCEPT {
offset -= value;
return *this;
}
storage_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
constexpr storage_iterator operator+(const difference_type value) const ENTT_NOEXCEPT {
storage_iterator copy = *this;
return (copy += value);
}
storage_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
constexpr storage_iterator &operator-=(const difference_type value) ENTT_NOEXCEPT {
return (*this += -value);
}
storage_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
constexpr storage_iterator operator-(const difference_type value) const ENTT_NOEXCEPT {
return (*this + -value);
}
[[nodiscard]] reference operator[](const difference_type value) const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator[](const difference_type value) const ENTT_NOEXCEPT {
const auto pos = index() - value;
return (*packed)[pos / comp_traits::page_size][fast_mod(pos, comp_traits::page_size)];
}
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
const auto pos = index();
return (*packed)[pos / comp_traits::page_size] + fast_mod(pos, comp_traits::page_size);
}
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
return *operator->();
}
[[nodiscard]] difference_type index() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr difference_type index() const ENTT_NOEXCEPT {
return offset - 1;
}
@@ -119,37 +119,37 @@ private:
};
template<typename CLhs, typename CRhs>
[[nodiscard]] std::ptrdiff_t operator-(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr std::ptrdiff_t operator-(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
return rhs.index() - lhs.index();
}
template<typename CLhs, typename CRhs>
[[nodiscard]] bool operator==(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
return lhs.index() == rhs.index();
}
template<typename CLhs, typename CRhs>
[[nodiscard]] bool operator!=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr 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 {
[[nodiscard]] constexpr bool operator<(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
return lhs.index() > rhs.index();
}
template<typename CLhs, typename CRhs>
[[nodiscard]] bool operator>(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator>(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
return lhs.index() < rhs.index();
}
template<typename CLhs, typename CRhs>
[[nodiscard]] bool operator<=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr 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 {
[[nodiscard]] constexpr bool operator>=(const storage_iterator<CLhs> &lhs, const storage_iterator<CRhs> &rhs) ENTT_NOEXCEPT {
return !(lhs < rhs);
}
@@ -165,47 +165,47 @@ public:
using difference_type = std::ptrdiff_t;
using iterator_category = std::input_iterator_tag;
extended_storage_iterator()
constexpr extended_storage_iterator()
: it{} {}
extended_storage_iterator(It base, Other... other)
constexpr extended_storage_iterator(It base, Other... other)
: it{base, other...} {}
template<typename... Args, typename = std::enable_if_t<(!std::is_same_v<Other, Args> && ...) && (std::is_constructible_v<Other, Args> && ...)>>
extended_storage_iterator(const extended_storage_iterator<It, Args...> &other)
constexpr extended_storage_iterator(const extended_storage_iterator<It, Args...> &other)
: it{other.it} {}
extended_storage_iterator &operator++() ENTT_NOEXCEPT {
constexpr extended_storage_iterator &operator++() ENTT_NOEXCEPT {
return ++std::get<It>(it), (++std::get<Other>(it), ...), *this;
}
extended_storage_iterator operator++(int) ENTT_NOEXCEPT {
constexpr extended_storage_iterator operator++(int) ENTT_NOEXCEPT {
extended_storage_iterator orig = *this;
return ++(*this), orig;
}
[[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr pointer operator->() const ENTT_NOEXCEPT {
return operator*();
}
[[nodiscard]] reference operator*() const ENTT_NOEXCEPT {
[[nodiscard]] constexpr reference operator*() const ENTT_NOEXCEPT {
return {*std::get<It>(it), *std::get<Other>(it)...};
}
template<typename... CLhs, typename... CRhs>
friend bool operator==(const extended_storage_iterator<CLhs...> &, const extended_storage_iterator<CRhs...> &) ENTT_NOEXCEPT;
friend constexpr bool operator==(const extended_storage_iterator<CLhs...> &, const extended_storage_iterator<CRhs...> &) ENTT_NOEXCEPT;
private:
std::tuple<It, Other...> it;
};
template<typename... CLhs, typename... CRhs>
[[nodiscard]] bool operator==(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
return std::get<0>(lhs.it) == std::get<0>(rhs.it);
}
template<typename... CLhs, typename... CRhs>
[[nodiscard]] bool operator!=(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const extended_storage_iterator<CLhs...> &lhs, const extended_storage_iterator<CRhs...> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}

View File

@@ -44,7 +44,7 @@ public:
using difference_type = typename iterator_type::difference_type;
using iterator_category = std::forward_iterator_tag;
view_iterator() ENTT_NOEXCEPT = default;
constexpr view_iterator() ENTT_NOEXCEPT = default;
view_iterator(iterator_type curr, iterator_type to, std::array<const Type *, pool_count> ref) ENTT_NOEXCEPT
: it{curr},
@@ -74,7 +74,7 @@ public:
}
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
friend bool operator==(const view_iterator<LhsType, LhsArgs...> &, const view_iterator<RhsType, RhsArgs...> &) ENTT_NOEXCEPT;
friend constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &, const view_iterator<RhsType, RhsArgs...> &) ENTT_NOEXCEPT;
private:
iterator_type it;
@@ -83,12 +83,12 @@ private:
};
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
[[nodiscard]] bool operator==(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
return lhs.it == rhs.it;
}
template<typename LhsType, typename... LhsArgs, typename RhsType, typename... RhsArgs>
[[nodiscard]] bool operator!=(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const view_iterator<LhsType, LhsArgs...> &lhs, const view_iterator<RhsType, RhsArgs...> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}
@@ -100,7 +100,7 @@ struct extended_view_iterator final {
using reference = value_type;
using iterator_category = std::input_iterator_tag;
extended_view_iterator()
constexpr extended_view_iterator()
: it{},
pools{} {}
@@ -126,7 +126,7 @@ struct extended_view_iterator final {
}
template<typename... Lhs, typename... Rhs>
friend bool operator==(const extended_view_iterator<Lhs...> &, const extended_view_iterator<Rhs...> &) ENTT_NOEXCEPT;
friend bool constexpr operator==(const extended_view_iterator<Lhs...> &, const extended_view_iterator<Rhs...> &) ENTT_NOEXCEPT;
private:
It it;
@@ -134,12 +134,12 @@ private:
};
template<typename... Lhs, typename... Rhs>
[[nodiscard]] bool operator==(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator==(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
return lhs.it == rhs.it;
}
template<typename... Lhs, typename... Rhs>
[[nodiscard]] bool operator!=(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
[[nodiscard]] constexpr bool operator!=(const extended_view_iterator<Lhs...> &lhs, const extended_view_iterator<Rhs...> &rhs) ENTT_NOEXCEPT {
return !(lhs == rhs);
}