Просмотр исходного кода

group: removed deprecated functions

Michele Caini 5 лет назад
Родитель
Сommit
a557e133d3
2 измененных файлов с 12 добавлено и 69 удалено
  1. 0 56
      src/entt/entity/group.hpp
  2. 12 13
      test/entt/entity/group.cpp

+ 0 - 56
src/entt/entity/group.hpp

@@ -338,34 +338,6 @@ public:
         traverse(std::move(func), get_type_list{});
         traverse(std::move(func), get_type_list{});
     }
     }
 
 
-    /**
-     * @brief Iterates entities and components and applies the given function
-     * object to them.
-     *
-     * The function object is invoked for each entity. It is provided with the
-     * entity itself and a set of references to non-empty components. The
-     * _constness_ of the components is as requested.<br/>
-     * The signature of the function must be equivalent to one of the following
-     * forms:
-     *
-     * @code{.cpp}
-     * void(const entity_type, Type &...);
-     * void(Type &...);
-     * @endcode
-     *
-     * @note
-     * Empty types aren't explicitly instantiated and therefore they are never
-     * returned during iterations.
-     *
-     * @tparam Func Type of the function object to invoke.
-     * @param func A valid function object.
-     */
-    template<typename Func>
-    [[deprecated("use ::each instead")]]
-    void less(Func func) const {
-        each(std::move(func));
-    }
-
     /**
     /**
      * @brief Sort a group according to the given comparison function.
      * @brief Sort a group according to the given comparison function.
      *
      *
@@ -777,34 +749,6 @@ public:
         traverse(std::move(func), owned_type_list{}, get_type_list{});
         traverse(std::move(func), owned_type_list{}, get_type_list{});
     }
     }
 
 
-    /**
-     * @brief Iterates entities and components and applies the given function
-     * object to them.
-     *
-     * The function object is invoked for each entity. It is provided with the
-     * entity itself and a set of references to non-empty components. The
-     * _constness_ of the components is as requested.<br/>
-     * The signature of the function must be equivalent to one of the following
-     * forms:
-     *
-     * @code{.cpp}
-     * void(const entity_type, Type &...);
-     * void(Type &...);
-     * @endcode
-     *
-     * @note
-     * Empty types aren't explicitly instantiated and therefore they are never
-     * returned during iterations.
-     *
-     * @tparam Func Type of the function object to invoke.
-     * @param func A valid function object.
-     */
-    template<typename Func>
-    [[deprecated("use ::each instead")]]
-    void less(Func func) const {
-        each(std::move(func));
-    }
-
     /**
     /**
      * @brief Checks whether the group can be sorted.
      * @brief Checks whether the group can be sorted.
      * @return True if the group can be sorted, false otherwise.
      * @return True if the group can be sorted, false otherwise.

+ 12 - 13
test/entt/entity/group.cpp

@@ -3,7 +3,6 @@
 #include <algorithm>
 #include <algorithm>
 #include <type_traits>
 #include <type_traits>
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <entt/entity/helper.hpp>
 #include <entt/entity/registry.hpp>
 #include <entt/entity/registry.hpp>
 #include <entt/entity/group.hpp>
 #include <entt/entity/group.hpp>
 
 
@@ -463,28 +462,28 @@ TEST(NonOwningGroup, TrackEntitiesOnComponentDestruction) {
     ASSERT_FALSE(cgroup.empty());
     ASSERT_FALSE(cgroup.empty());
 }
 }
 
 
-TEST(NonOwningGroup, Less) {
+TEST(NonOwningGroup, EachWithEmptyTypes) {
     entt::registry registry;
     entt::registry registry;
     const auto entity = registry.create();
     const auto entity = registry.create();
 
 
     registry.emplace<int>(entity);
     registry.emplace<int>(entity);
     registry.emplace<char>(entity);
     registry.emplace<char>(entity);
-    registry.emplace<entt::tag<"empty"_hs>>(entity);
+    registry.emplace<empty_type>(entity);
 
 
-    registry.group(entt::get<int, char, entt::tag<"empty"_hs>>).less([entity](const auto entt, int, char) {
+    registry.group(entt::get<int, char, empty_type>).each([entity](const auto entt, int, char) {
         ASSERT_EQ(entity, entt);
         ASSERT_EQ(entity, entt);
     });
     });
 
 
-    registry.group(entt::get<int, entt::tag<"empty"_hs>, char>).less([check = true](int, char) mutable {
+    registry.group(entt::get<int, empty_type, char>).each([check = true](int, char) mutable {
         ASSERT_TRUE(check);
         ASSERT_TRUE(check);
         check = false;
         check = false;
     });
     });
 
 
-    registry.group(entt::get<entt::tag<"empty"_hs>, int, char>).less([entity](const auto entt, int, char) {
+    registry.group(entt::get<empty_type, int, char>).each([entity](const auto entt, int, char) {
         ASSERT_EQ(entity, entt);
         ASSERT_EQ(entity, entt);
     });
     });
 
 
-    registry.group(entt::get<int, char, double>).less([](const auto, int, char, double) { FAIL(); });
+    registry.group(entt::get<int, char, double>).each([](const auto, int, char, double) { FAIL(); });
 }
 }
 
 
 TEST(NonOwningGroup, FrontBack) {
 TEST(NonOwningGroup, FrontBack) {
@@ -1058,28 +1057,28 @@ TEST(OwningGroup, TrackEntitiesOnComponentDestruction) {
     ASSERT_FALSE(cgroup.empty());
     ASSERT_FALSE(cgroup.empty());
 }
 }
 
 
-TEST(OwningGroup, Less) {
+TEST(OwningGroup, EachWithEmptyTypes) {
     entt::registry registry;
     entt::registry registry;
     const auto entity = registry.create();
     const auto entity = registry.create();
 
 
     registry.emplace<int>(entity);
     registry.emplace<int>(entity);
     registry.emplace<char>(entity);
     registry.emplace<char>(entity);
-    registry.emplace<entt::tag<"empty"_hs>>(entity);
+    registry.emplace<empty_type>(entity);
 
 
-    registry.group<int>(entt::get<char, entt::tag<"empty"_hs>>).less([entity](const auto entt, int, char) {
+    registry.group<int>(entt::get<char, empty_type>).each([entity](const auto entt, int, char) {
         ASSERT_EQ(entity, entt);
         ASSERT_EQ(entity, entt);
     });
     });
 
 
-    registry.group<char>(entt::get<entt::tag<"empty"_hs>, int>).less([check = true](int, char) mutable {
+    registry.group<char>(entt::get<empty_type, int>).each([check = true](int, char) mutable {
         ASSERT_TRUE(check);
         ASSERT_TRUE(check);
         check = false;
         check = false;
     });
     });
 
 
-    registry.group<entt::tag<"empty"_hs>>(entt::get<int, char>).less([entity](const auto entt, int, char) {
+    registry.group<empty_type>(entt::get<int, char>).each([entity](const auto entt, int, char) {
         ASSERT_EQ(entity, entt);
         ASSERT_EQ(entity, entt);
     });
     });
 
 
-    registry.group<double>(entt::get<int, char>).less([](const auto, double, int, char) { FAIL(); });
+    registry.group<double>(entt::get<int, char>).each([](const auto, double, int, char) { FAIL(); });
 }
 }
 
 
 TEST(OwningGroup, FrontBack) {
 TEST(OwningGroup, FrontBack) {