diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 75b886a46..bb54e6c39 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -31,6 +31,13 @@ template return (!(filter[Index] && filter[Index]->contains(entt)) && ...); } +template +[[nodiscard]] auto fully_initialized(const std::array &filter) noexcept { + std::size_t pos{}; + for(; pos < N && filter[pos] != nullptr; ++pos) {} + return pos == N; +} + template [[nodiscard]] auto view_pack(const std::tuple value, const std::tuple excl, std::index_sequence) { const auto pools = std::tuple_cat(value, excl); @@ -454,8 +461,7 @@ public: * @return True if the view is fully initialized, false otherwise. */ [[nodiscard]] explicit operator bool() const noexcept { - return std::apply([](const auto *...curr) { return ((curr != nullptr) && ...); }, pools) - && std::apply([](const auto *...curr) { return ((curr != nullptr) && ...); }, filter); + return std::apply([](const auto *...curr) { return ((curr != nullptr) && ...); }, pools) && internal::fully_initialized(filter); } /**