Minor ecs::entity_container documentation fixes

This commit is contained in:
Nikita Lisitsa 2023-08-26 22:00:56 +03:00
parent 7183a441e5
commit f46b3bdc40

View file

@ -36,8 +36,7 @@ namespace psemek::ecs
entity_handle create(Components && ... components); entity_handle create(Components && ... components);
/** Check if an entity handle refers to an alive entity (i.e. one that wasn't /** Check if an entity handle refers to an alive entity (i.e. one that wasn't
* destroyed yet. * destroyed yet).
* Destroying an entity invalidates all previously created entity accessors.
* If the handle wasn't previously obtained by a `create()` call, the * If the handle wasn't previously obtained by a `create()` call, the
* behavior is undefined. * behavior is undefined.
*/ */
@ -53,12 +52,13 @@ namespace psemek::ecs
*/ */
void destroy(entity_handle const & entity); void destroy(entity_handle const & entity);
/** Get an entity accessor for an entity, which provides access to /** Get an entity accessor for an entity, which provides access to the entity's components.
* the entitie's components. * It is designed to be a single-use object; it cannot be stored as a reference to
* the entity. Use entity_handle for that instead.
* Creating or destroying entities, as well as attaching or detaching components,
* invalidates all previously created entity accessors.
* If the handle wasn't previously obtained by a `create()` call, or * If the handle wasn't previously obtained by a `create()` call, or
* the refered entity was already destroyed, the behavior is undefined. * the referred entity was already destroyed, the behavior is undefined.
* Creating or destroying entities invalidates all previously created
* entity accessors.
*/ */
entity_accessor get(entity_handle const & entity); entity_accessor get(entity_handle const & entity);
@ -89,8 +89,7 @@ namespace psemek::ecs
template <typename ... Components> template <typename ... Components>
void detach(entity_handle const & entity); void detach(entity_handle const & entity);
/** Create a query cache that can be used for speeding up /** Create a query cache that can be used to speed up `apply()` calls.
* the `apply()` calls.
*/ */
template <typename ... Components> template <typename ... Components>
query_cache cache(); query_cache cache();