runtime_view: size -> size_hint, misleading name (breaking change)

This commit is contained in:
Michele Caini
2020-11-11 16:59:20 +01:00
parent 6cfa024ea2
commit 12847593c2
2 changed files with 7 additions and 7 deletions

View File

@@ -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{};
}

View File

@@ -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(); });