diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 11b9474d3..cab425c5b 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -186,17 +186,11 @@ public: } /** - * @brief Checks whether a group or some pools are empty. - * @tparam Component Types of components in which one is interested. - * @return True if the group or the pools are empty, false otherwise. + * @brief Checks whether a group is empty. + * @return True if the group is empty, false otherwise. */ - template [[nodiscard]] bool empty() const ENTT_NOEXCEPT { - if constexpr(sizeof...(Component) == 0) { - return handler->empty(); - } else { - return (std::get *>(pools)->empty() && ...); - } + return handler->empty(); } /** @@ -697,17 +691,11 @@ public: } /** - * @brief Checks whether a group or some pools are empty. - * @tparam Component Types of components in which one is interested. - * @return True if the group or the pools are empty, false otherwise. + * @brief Checks whether a group is empty. + * @return True if the group is empty, false otherwise. */ - template [[nodiscard]] bool empty() const ENTT_NOEXCEPT { - if constexpr(sizeof...(Component) == 0) { - return !*length; - } else { - return (std::get *>(pools)->empty() && ...); - } + return !*length; } /** diff --git a/test/entt/entity/group.cpp b/test/entt/entity/group.cpp index 58e661f74..22ee2f3c2 100644 --- a/test/entt/entity/group.cpp +++ b/test/entt/entity/group.cpp @@ -19,8 +19,6 @@ TEST(NonOwningGroup, Functionalities) { auto cgroup = std::as_const(registry).group(entt::get); ASSERT_TRUE(group.empty()); - ASSERT_TRUE((group.empty())); - ASSERT_TRUE((cgroup.empty())); const auto e0 = registry.create(); registry.emplace(e0, '1'); @@ -30,8 +28,6 @@ TEST(NonOwningGroup, Functionalities) { registry.emplace(e1, '2'); ASSERT_FALSE(group.empty()); - ASSERT_FALSE(group.empty()); - ASSERT_FALSE(cgroup.empty()); ASSERT_NO_THROW(group.begin()++); ASSERT_NO_THROW(++cgroup.begin()); ASSERT_NO_THROW([](auto it) { return it++; }(group.rbegin())); @@ -582,8 +578,6 @@ TEST(OwningGroup, Functionalities) { auto cgroup = std::as_const(registry).group(entt::get); ASSERT_TRUE(group.empty()); - ASSERT_TRUE((group.empty())); - ASSERT_TRUE((cgroup.empty())); const auto e0 = registry.create(); registry.emplace(e0, '1'); @@ -593,8 +587,6 @@ TEST(OwningGroup, Functionalities) { registry.emplace(e1, '2'); ASSERT_FALSE(group.empty()); - ASSERT_FALSE(group.empty()); - ASSERT_FALSE(cgroup.empty()); ASSERT_NO_THROW(group.begin()++); ASSERT_NO_THROW(++cgroup.begin()); ASSERT_NO_THROW([](auto it) { return it++; }(group.rbegin()));