diff --git a/docs/md/entity.md b/docs/md/entity.md index 9efb60445..18adaa51d 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -1222,11 +1222,9 @@ for(auto &&[entity, pos, vel]: registry.view().proxy()) { } ``` -The `each` member functions are highly optimized. Unless users want to iterate -only entities or get only some of the components, this should be the preferred -approach. Note that entities can also be excluded from the parameter list when -received through a callback and this can improve even further the performance -during iterations.
+Note that entities can also be excluded from the parameter list when received +through a callback and this can improve even further the performance during +iterations.
Since they aren't explicitly instantiated, empty components aren't returned in any case. @@ -1385,11 +1383,9 @@ for(auto &&[entity, pos, vel]: registry.group(entt::get).pro } ``` -The `each` member functions are highly optimized. Unless users want to iterate -only entities or get only some of the components, this should be the preferred -approach. Note that entities can also be excluded from the parameter list when -received through a callback and this can improve even further the performance -during iterations.
+Note that entities can also be excluded from the parameter list when received +through a callback and this can improve even further the performance during +iterations.
Since they aren't explicitly instantiated, empty components aren't returned in any case. diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 8dc57603d..cfbd881cf 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -282,46 +282,43 @@ public: } /** - * @brief Returns an iterator to the first entity that has the given - * components. + * @brief Returns an iterator to the first entity of the group. * - * The returned iterator points to the first entity that has the given - * components. If the group is empty, the returned iterator will be equal to - * `end()`. + * The returned iterator points to the first entity of the group. If the + * group is empty, the returned iterator will be equal to `end()`. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the first entity that has the given components. + * @return An iterator to the first entity of the group. */ [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { return handler->begin(); } /** - * @brief Returns an iterator that is past the last entity that has the - * given components. + * @brief Returns an iterator that is past the last entity of the group. * - * The returned iterator points to the entity following the last entity that - * has the given components. Attempting to dereference the returned iterator - * results in undefined behavior. + * The returned iterator points to the entity following the last entity of + * the group. Attempting to dereference the returned iterator results in + * undefined behavior. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the entity following the last entity that has the - * given components. + * @return An iterator to the entity following the last entity of the + * group. */ [[nodiscard]] iterator end() const ENTT_NOEXCEPT { return handler->end(); } /** - * @brief Returns the first entity that has the given components, if any. - * @return The first entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the first entity of the group, if any. + * @return The first entity of the group if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type front() const { const auto it = begin(); @@ -329,9 +326,9 @@ public: } /** - * @brief Returns the last entity that has the given components, if any. - * @return The last entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the last entity of the group, if any. + * @return The last entity of the group if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type back() const { const auto it = std::make_reverse_iterator(end()); @@ -817,46 +814,43 @@ public: } /** - * @brief Returns an iterator to the first entity that has the given - * components. + * @brief Returns an iterator to the first entity of the group. * - * The returned iterator points to the first entity that has the given - * components. If the group is empty, the returned iterator will be equal to - * `end()`. + * The returned iterator points to the first entity of the group. If the + * group is empty, the returned iterator will be equal to `end()`. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the first entity that has the given components. + * @return An iterator to the first entity of the group. */ [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { return std::get<0>(pools)->sparse_set::end() - *length; } /** - * @brief Returns an iterator that is past the last entity that has the - * given components. + * @brief Returns an iterator that is past the last entity of the group. * - * The returned iterator points to the entity following the last entity that - * has the given components. Attempting to dereference the returned iterator - * results in undefined behavior. + * The returned iterator points to the entity following the last entity of + * the group. Attempting to dereference the returned iterator results in + * undefined behavior. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the entity following the last entity that has the - * given components. + * @return An iterator to the entity following the last entity of the + * group. */ [[nodiscard]] iterator end() const ENTT_NOEXCEPT { return std::get<0>(pools)->sparse_set::end(); } /** - * @brief Returns the first entity that has the given components, if any. - * @return The first entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the first entity of the group, if any. + * @return The first entity of the group if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type front() const { const auto it = begin(); @@ -864,9 +858,9 @@ public: } /** - * @brief Returns the last entity that has the given components, if any. - * @return The last entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the last entity of the group, if any. + * @return The last entity of the group if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type back() const { const auto it = std::make_reverse_iterator(end()); diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 9308a404a..c1b68432d 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -410,18 +410,16 @@ public: } /** - * @brief Returns an iterator to the first entity that has the given - * components. + * @brief Returns an iterator to the first entity of the view. * - * The returned iterator points to the first entity that has the given - * components. If the view is empty, the returned iterator will be equal to - * `end()`. + * The returned iterator points to the first entity of the view. If the + * view is empty, the returned iterator will be equal to `end()`. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the first entity that has the given components. + * @return An iterator to the first entity of the view. */ [[nodiscard]] iterator begin() const { const auto &view = candidate(); @@ -429,19 +427,17 @@ public: } /** - * @brief Returns an iterator that is past the last entity that has the - * given components. + * @brief Returns an iterator that is past the last entity of the view. * - * The returned iterator points to the entity following the last entity that - * has the given components. Attempting to dereference the returned iterator - * results in undefined behavior. + * The returned iterator points to the entity following the last entity of + * the view. Attempting to dereference the returned iterator results in + * undefined behavior. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the entity following the last entity that has the - * given components. + * @return An iterator to the entity following the last entity of the view. */ [[nodiscard]] iterator end() const { const auto &view = candidate(); @@ -449,9 +445,9 @@ public: } /** - * @brief Returns the first entity that has the given components, if any. - * @return The first entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the first entity of the view, if any. + * @return The first entity of the view if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type front() const { const auto it = begin(); @@ -459,9 +455,9 @@ public: } /** - * @brief Returns the last entity that has the given components, if any. - * @return The last entity that has the given components if one exists, the - * null entity otherwise. + * @brief Returns the last entity of the view, if any. + * @return The last entity of the view if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type back() const { const auto it = std::make_reverse_iterator(end()); @@ -828,46 +824,42 @@ public: } /** - * @brief Returns an iterator to the first entity that has the given - * component. + * @brief Returns an iterator to the first entity of the view. * - * The returned iterator points to the first entity that has the given - * component. If the view is empty, the returned iterator will be equal to - * `end()`. + * The returned iterator points to the first entity of the view. If the + * view is empty, the returned iterator will be equal to `end()`. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the first entity that has the given component. + * @return An iterator to the first entity of the view. */ [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { return pool->sparse_set::begin(); } /** - * @brief Returns an iterator that is past the last entity that has the - * given component. + * @brief Returns an iterator that is past the last entity of the view. * - * The returned iterator points to the entity following the last entity that - * has the given component. Attempting to dereference the returned iterator - * results in undefined behavior. + * The returned iterator points to the entity following the last entity of + * the view. Attempting to dereference the returned iterator results in + * undefined behavior. * * @note * Iterators stay true to the order imposed to the underlying data * structures. * - * @return An iterator to the entity following the last entity that has the - * given component. + * @return An iterator to the entity following the last entity of the view. */ [[nodiscard]] iterator end() const ENTT_NOEXCEPT { return pool->sparse_set::end(); } /** - * @brief Returns the first entity that has the given component, if any. - * @return The first entity that has the given component if one exists, the - * null entity otherwise. + * @brief Returns the first entity of the view, if any. + * @return The first entity of the view if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type front() const { const auto it = begin(); @@ -875,9 +867,9 @@ public: } /** - * @brief Returns the last entity that has the given component, if any. - * @return The last entity that has the given component if one exists, the - * null entity otherwise. + * @brief Returns the last entity of the view, if any. + * @return The last entity of the view if one exists, the null entity + * otherwise. */ [[nodiscard]] entity_type back() const { const auto it = std::make_reverse_iterator(end());