view: stable multi type view ::size_hint function
This commit is contained in:
@@ -379,7 +379,7 @@ public:
|
||||
* @return Estimated number of entities iterated by the view.
|
||||
*/
|
||||
[[nodiscard]] size_type size_hint() const noexcept {
|
||||
return view->size();
|
||||
return view ? view->size() : size_type{};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -630,6 +630,8 @@ TEST(MultiComponentView, InvalidView) {
|
||||
|
||||
ASSERT_FALSE(view);
|
||||
|
||||
ASSERT_EQ(view.size_hint(), 0u);
|
||||
|
||||
entt::storage<int> storage;
|
||||
view.storage(storage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user