group: removed ::empty<T...>, misleading information (breaking change)

This commit is contained in:
Michele Caini
2020-11-10 15:42:50 +01:00
parent f8015036a9
commit 7e91e27f14
2 changed files with 6 additions and 26 deletions

View File

@@ -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<typename... Component>
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
if constexpr(sizeof...(Component) == 0) {
return handler->empty();
} else {
return (std::get<storage_type<Component> *>(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<typename... Component>
[[nodiscard]] bool empty() const ENTT_NOEXCEPT {
if constexpr(sizeof...(Component) == 0) {
return !*length;
} else {
return (std::get<storage_type<Component> *>(pools)->empty() && ...);
}
return !*length;
}
/**

View File

@@ -19,8 +19,6 @@ TEST(NonOwningGroup, Functionalities) {
auto cgroup = std::as_const(registry).group(entt::get<const int, const char>);
ASSERT_TRUE(group.empty());
ASSERT_TRUE((group.empty<int, char>()));
ASSERT_TRUE((cgroup.empty<const int, const char>()));
const auto e0 = registry.create();
registry.emplace<char>(e0, '1');
@@ -30,8 +28,6 @@ TEST(NonOwningGroup, Functionalities) {
registry.emplace<char>(e1, '2');
ASSERT_FALSE(group.empty());
ASSERT_FALSE(group.empty<int>());
ASSERT_FALSE(cgroup.empty<const char>());
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<const int>(entt::get<const char>);
ASSERT_TRUE(group.empty());
ASSERT_TRUE((group.empty<int, char>()));
ASSERT_TRUE((cgroup.empty<const int, const char>()));
const auto e0 = registry.create();
registry.emplace<char>(e0, '1');
@@ -593,8 +587,6 @@ TEST(OwningGroup, Functionalities) {
registry.emplace<char>(e1, '2');
ASSERT_FALSE(group.empty());
ASSERT_FALSE(group.empty<int>());
ASSERT_FALSE(cgroup.empty<const char>());
ASSERT_NO_THROW(group.begin()++);
ASSERT_NO_THROW(++cgroup.begin());
ASSERT_NO_THROW([](auto it) { return it++; }(group.rbegin()));