doc: minor changes

This commit is contained in:
Michele Caini
2020-08-03 17:42:54 +02:00
parent 24248832d1
commit 4eacb58a3e
3 changed files with 68 additions and 86 deletions

View File

@@ -1222,11 +1222,9 @@ for(auto &&[entity, pos, vel]: registry.view<position, velocity>().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.<br/>
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.<br/>
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<position>(entt::get<velocity>).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.<br/>
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.<br/>
Since they aren't explicitly instantiated, empty components aren't returned in
any case.

View File

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

View File

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