view: stable single type view ::find function
This commit is contained in:
@@ -763,7 +763,7 @@ public:
|
||||
* iterator otherwise.
|
||||
*/
|
||||
[[nodiscard]] iterator find(const entity_type entt) const noexcept {
|
||||
return view->find(entt);
|
||||
return view ? view->find(entt) : iterator{};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,6 +79,7 @@ TEST(SingleComponentView, InvalidView) {
|
||||
ASSERT_EQ(view.size(), 0u);
|
||||
ASSERT_TRUE(view.empty());
|
||||
ASSERT_FALSE(view.contains(entt::null));
|
||||
ASSERT_EQ(view.find(entt::null), view.end());
|
||||
|
||||
ASSERT_EQ(view.front(), static_cast<entt::entity>(entt::null));
|
||||
ASSERT_EQ(view.back(), static_cast<entt::entity>(entt::null));
|
||||
|
||||
Reference in New Issue
Block a user