|
EnTT
3.2.2
|
Runtime view. More...
#include <runtime_view.hpp>
Public Types | |
| using | entity_type = Entity |
| Underlying entity identifier. | |
| using | size_type = std::size_t |
| Unsigned integer type. | |
| using | iterator_type = iterator |
| Input iterator type. | |
Public Member Functions | |
| size_type | size () const ENTT_NOEXCEPT |
| Estimates the number of entities that have the given components. More... | |
| bool | empty () const ENTT_NOEXCEPT |
| Checks if the view is definitely empty. More... | |
| iterator_type | begin () const ENTT_NOEXCEPT |
| Returns an iterator to the first entity that has the given components. More... | |
| iterator_type | end () const ENTT_NOEXCEPT |
| Returns an iterator that is past the last entity that has the given components. More... | |
| bool | contains (const entity_type entt) const ENTT_NOEXCEPT |
| Checks if a view contains an entity. More... | |
| template<typename Func > | |
| void | each (Func func) const |
| Iterates entities and applies the given function object to them. More... | |
Friends | |
| class | basic_registry< Entity > |
| A registry is allowed to create views. | |
Runtime view.
Runtime views iterate over those entities that have at least all the given components in their bags. During initialization, a runtime view looks at the number of entities available for each component and picks up a reference to the smallest set of candidate entities in order to get a performance boost when iterate.
Order of elements during iterations are highly dependent on the order of the underlying data structures. See sparse_set and its specializations for more details.
Important
Iterators aren't invalidated if:
In all the other cases, modifying the pools of the given components in any way invalidates all the iterators and using them results in undefined behavior.
| Entity | A valid entity type (see entt_traits for more details). |
|
inline |
Returns an iterator to the first entity that has the given components.
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().
Definition at line 179 of file runtime_view.hpp.
|
inline |
Checks if a view contains an entity.
| entt | A valid entity identifier. |
Definition at line 222 of file runtime_view.hpp.
|
inline |
Iterates entities and applies the given function object to them.
The function object is invoked for each entity. It is provided only with the entity itself. To get the components, users can use the registry with which the view was built.
The signature of the function should be equivalent to the following:
| Func | Type of the function object to invoke. |
| func | A valid function object. |
Definition at line 244 of file runtime_view.hpp.
|
inline |
Checks if the view is definitely empty.
Definition at line 161 of file runtime_view.hpp.
|
inline |
Returns an iterator that is past the last entity that has the given components.
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.
Definition at line 206 of file runtime_view.hpp.
|
inline |
Estimates the number of entities that have the given components.
Definition at line 153 of file runtime_view.hpp.
1.8.16