|
EnTT 3.12.0
|
Generic runtime view. More...
#include <runtime_view.hpp>
Public Types | |
| using | allocator_type = Allocator |
| Allocator type. | |
| using | entity_type = typename Type::entity_type |
| Underlying entity identifier. | |
| using | size_type = std::size_t |
| Unsigned integer type. | |
| using | common_type = Type |
| Common type among all storage types. | |
| using | iterator = internal::runtime_view_iterator< common_type > |
| Bidirectional iterator type. | |
Public Member Functions | |
| basic_runtime_view () noexcept | |
| Default constructor to use to create empty, invalid views. | |
| basic_runtime_view (const allocator_type &allocator) | |
| Constructs an empty, invalid view with a given allocator. | |
| basic_runtime_view (const basic_runtime_view &)=default | |
| Default copy constructor. | |
| basic_runtime_view (const basic_runtime_view &other, const allocator_type &allocator) | |
| Allocator-extended copy constructor. | |
| basic_runtime_view (basic_runtime_view &&) noexcept(std::is_nothrow_move_constructible_v< container_type >)=default | |
| Default move constructor. | |
| basic_runtime_view (basic_runtime_view &&other, const allocator_type &allocator) | |
| Allocator-extended move constructor. | |
| basic_runtime_view & | operator= (const basic_runtime_view &)=default |
| Default copy assignment operator. | |
| basic_runtime_view & | operator= (basic_runtime_view &&) noexcept(std::is_nothrow_move_assignable_v< container_type >)=default |
| Default move assignment operator. | |
| void | swap (basic_runtime_view &other) |
| Exchanges the contents with those of a given view. | |
| constexpr allocator_type | get_allocator () const noexcept |
| Returns the associated allocator. | |
| void | clear () |
| Clears the view. | |
| basic_runtime_view & | iterate (common_type &base) |
| Appends an opaque storage object to a runtime view. | |
| basic_runtime_view & | exclude (common_type &base) |
| Adds an opaque storage object as a filter of a runtime view. | |
| size_type | size_hint () const |
| Estimates the number of entities iterated by the view. | |
| iterator | begin () const |
| Returns an iterator to the first entity that has the given components. | |
| iterator | end () const |
| Returns an iterator that is past the last entity that has the given components. | |
| bool | contains (const entity_type entt) const |
| Checks if a view contains an entity. | |
| template<typename Func > | |
| void | each (Func func) const |
| Iterates entities and applies the given function object to them. | |
Generic runtime view.
Runtime views iterate over those entities that are at least in the given storage. During initialization, a runtime view looks at the number of entities available for each component and uses the smallest set in order to get a performance boost when iterating.
Important
Iterators aren't invalidated if:
In all other cases, modifying the storage iterated by the view in any way invalidates all the iterators.
| Type | Common base type. |
| Allocator | Type of allocator used to manage memory and elements. |
Definition at line 128 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::allocator_type = Allocator |
Allocator type.
Definition at line 135 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::common_type = Type |
Common type among all storage types.
Definition at line 141 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::entity_type = typename Type::entity_type |
Underlying entity identifier.
Definition at line 137 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::iterator = internal::runtime_view_iterator<common_type> |
Bidirectional iterator type.
Definition at line 143 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::size_type = std::size_t |
Unsigned integer type.
Definition at line 139 of file runtime_view.hpp.
|
inlinenoexcept |
Default constructor to use to create empty, invalid views.
Definition at line 146 of file runtime_view.hpp.
|
inlineexplicit |
Constructs an empty, invalid view with a given allocator.
| allocator | The allocator to use. |
Definition at line 153 of file runtime_view.hpp.
|
inline |
Allocator-extended copy constructor.
| other | The instance to copy from. |
| allocator | The allocator to use. |
Definition at line 165 of file runtime_view.hpp.
|
inline |
Allocator-extended move constructor.
| other | The instance to move from. |
| allocator | The allocator to use. |
Definition at line 177 of file runtime_view.hpp.
|
inline |
Returns an iterator 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 258 of file runtime_view.hpp.
|
inline |
Clears the view.
Definition at line 212 of file runtime_view.hpp.
|
inline |
Checks if a view contains an entity.
| entt | A valid identifier. |
Definition at line 277 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.
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 298 of file runtime_view.hpp.
|
inline |
Returns an iterator that is past the last entity that has the given components.
Definition at line 268 of file runtime_view.hpp.
|
inline |
Adds an opaque storage object as a filter of a runtime view.
| base | An opaque reference to a storage object. |
Definition at line 237 of file runtime_view.hpp.
|
inlineconstexprnoexcept |
Returns the associated allocator.
Definition at line 207 of file runtime_view.hpp.
|
inline |
Appends an opaque storage object to a runtime view.
| base | An opaque reference to a storage object. |
Definition at line 222 of file runtime_view.hpp.
|
defaultnoexcept |
Default move assignment operator.
|
default |
Default copy assignment operator.
|
inline |
Estimates the number of entities iterated by the view.
Definition at line 246 of file runtime_view.hpp.
|
inline |
Exchanges the contents with those of a given view.
| other | View to exchange the content with. |
Definition at line 197 of file runtime_view.hpp.