template<typename Entity>
class entt::basic_runtime_view< Entity >
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:
- New instances of the given components are created and assigned to entities.
- The entity currently pointed is modified (as an example, if one of the given components is removed from the entity to which the iterator points).
- The entity currently pointed is destroyed.
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.
- Note
- Views share references to the underlying data structures of the registry that generated them. Therefore any change to the entities and to the components made by means of the registry are immediately reflected by the views, unless a pool was missing when the view was built (in this case, the view won't have a valid reference and won't be updated accordingly).
- Warning
- Lifetime of a view must not overcome that of the registry that generated it. In any other case, attempting to use a view results in undefined behavior.
- Template Parameters
-
Entity | A valid entity type (see entt_traits for more details). |