فهرست منبع

view: removed multi component view ::empty (breaking changes)

Michele Caini 5 سال پیش
والد
کامیت
111dd40097
2فایلهای تغییر یافته به همراه0 افزوده شده و 28 حذف شده
  1. 0 19
      src/entt/entity/view.hpp
  2. 0 9
      test/entt/entity/view.cpp

+ 0 - 19
src/entt/entity/view.hpp

@@ -351,25 +351,6 @@ public:
         return size_hint();
     }
 
-    /**
-     * @brief Checks whether a view or some pools are empty.
-     *
-     * The view is definitely empty if one of the pools it uses is empty. In all
-     * other cases, the view may be empty and not return entities even if this
-     * function returns false.
-     *
-     * @tparam Comp Types of components in which one is interested.
-     * @return True if the view or the pools are empty, false otherwise.
-     */
-    template<typename... Comp>
-    [[nodiscard]] bool empty() const ENTT_NOEXCEPT {
-        if constexpr(sizeof...(Comp) == 0) {
-            return (std::get<pool_type<Component> *>(pools)->empty() || ...);
-        } else {
-            return (std::get<pool_type<Comp> *>(pools)->empty() && ...);
-        }
-    }
-
     /**
      * @brief Direct access to the list of components of a given pool.
      *

+ 0 - 9
test/entt/entity/view.cpp

@@ -283,20 +283,11 @@ TEST(MultiComponentView, Functionalities) {
     auto view = registry.view<int, char>();
     auto cview = std::as_const(registry).view<const int, const char>();
 
-    ASSERT_TRUE(view.empty());
-    ASSERT_TRUE((view.empty<int, char>()));
-    ASSERT_TRUE((cview.empty<const int, const char>()));
-
     const auto e0 = registry.create();
     registry.emplace<char>(e0);
 
     const auto e1 = registry.create();
     registry.emplace<int>(e1);
-
-    ASSERT_FALSE(view.empty());
-    ASSERT_FALSE((view.empty<int>()));
-    ASSERT_FALSE((cview.empty<const char>()));
-
     registry.emplace<char>(e1);
 
     ASSERT_EQ(*view.begin(), e1);