runtime_view: size -> size_hint, misleading name (breaking change)
This commit is contained in:
@@ -154,10 +154,10 @@ public:
|
||||
using iterator = view_iterator;
|
||||
|
||||
/**
|
||||
* @brief Estimates the number of entities that have the given components.
|
||||
* @return Estimated number of entities that have the given components.
|
||||
* @brief Estimates the number of entities iterated by the view.
|
||||
* @return Estimated number of entities iterated by the view.
|
||||
*/
|
||||
[[nodiscard]] size_type size() const {
|
||||
[[nodiscard]] size_type size_hint() const {
|
||||
return valid() ? pools.front()->size() : size_type{};
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ TEST(RuntimeView, Functionalities) {
|
||||
ASSERT_NO_THROW((++view.begin()));
|
||||
|
||||
ASSERT_NE(view.begin(), view.end());
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){1});
|
||||
ASSERT_EQ(view.size_hint(), 1u);
|
||||
|
||||
registry.get<char>(e0) = '1';
|
||||
registry.get<char>(e1) = '2';
|
||||
@@ -170,12 +170,12 @@ TEST(RuntimeView, MissingPool) {
|
||||
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
||||
|
||||
ASSERT_TRUE(view.empty());
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){0});
|
||||
ASSERT_EQ(view.size_hint(), 0u);
|
||||
|
||||
registry.emplace<char>(e0);
|
||||
|
||||
ASSERT_TRUE(view.empty());
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){0});
|
||||
ASSERT_EQ(view.size_hint(), 0u);
|
||||
ASSERT_FALSE(view.contains(e0));
|
||||
|
||||
view.each([](auto) { FAIL(); });
|
||||
@@ -193,7 +193,7 @@ TEST(RuntimeView, EmptyRange) {
|
||||
auto view = registry.runtime_view(ptr, ptr);
|
||||
|
||||
ASSERT_TRUE(view.empty());
|
||||
ASSERT_EQ(view.size(), decltype(view.size()){0});
|
||||
ASSERT_EQ(view.size_hint(), 0u);
|
||||
ASSERT_FALSE(view.contains(e0));
|
||||
|
||||
view.each([](auto) { FAIL(); });
|
||||
|
||||
Reference in New Issue
Block a user