|
EnTT 3.16.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 | difference_type = std::ptrdiff_t |
| Signed 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=default | |
| Default move constructor. | |
| basic_runtime_view (basic_runtime_view &&other, const allocator_type &allocator) | |
| Allocator-extended move constructor. | |
| ~basic_runtime_view ()=default | |
| Default destructor. | |
| basic_runtime_view & | operator= (const basic_runtime_view &)=default |
| Default copy assignment operator. | |
| basic_runtime_view & | operator= (basic_runtime_view &&) noexcept=default |
| Default move assignment operator. | |
| void | swap (basic_runtime_view &other) noexcept |
| 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 elements. | |
| iterator | end () const |
| Returns an iterator that is past the last entity that has the given elements. | |
| operator bool () const noexcept | |
| Checks whether a view is initialized or not. | |
| 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 element 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 123 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::allocator_type = Allocator |
Allocator type.
Definition at line 136 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::common_type = Type |
Common type among all storage types.
Definition at line 144 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::difference_type = std::ptrdiff_t |
Signed integer type.
Definition at line 142 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::entity_type = typename Type::entity_type |
Underlying entity identifier.
Definition at line 138 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 146 of file runtime_view.hpp.
| using entt::basic_runtime_view< Type, Allocator >::size_type = std::size_t |
Unsigned integer type.
Definition at line 140 of file runtime_view.hpp.
|
inlinenoexcept |
Default constructor to use to create empty, invalid views.
Definition at line 149 of file runtime_view.hpp.
|
inlineexplicit |
Constructs an empty, invalid view with a given allocator.
| allocator | The allocator to use. |
Definition at line 156 of file runtime_view.hpp.
|
inline |
Allocator-extended copy constructor.
| other | The instance to copy from. |
| allocator | The allocator to use. |
Definition at line 168 of file runtime_view.hpp.
|
inline |
Allocator-extended move constructor.
| other | The instance to move from. |
| allocator | The allocator to use. |
Definition at line 180 of file runtime_view.hpp.
|
inlinenodiscard |
Returns an iterator to the first entity that has the given elements.
If the view is empty, the returned iterator will be equal to end().
Definition at line 264 of file runtime_view.hpp.
|
inline |
Clears the view.
Definition at line 218 of file runtime_view.hpp.
|
inlinenodiscard |
Checks if a view contains an entity.
| entt | A valid identifier. |
Definition at line 291 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 313 of file runtime_view.hpp.
|
inlinenodiscard |
Returns an iterator that is past the last entity that has the given elements.
Definition at line 274 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 243 of file runtime_view.hpp.
|
inlinenodiscardconstexprnoexcept |
Returns the associated allocator.
Definition at line 213 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 228 of file runtime_view.hpp.
|
inlineexplicitnodiscardnoexcept |
Checks whether a view is initialized or not.
Definition at line 282 of file runtime_view.hpp.
|
defaultnoexcept |
Default move assignment operator.
|
default |
Default copy assignment operator.
|
inlinenodiscard |
Estimates the number of entities iterated by the view.
Definition at line 252 of file runtime_view.hpp.
|
inlinenoexcept |
Exchanges the contents with those of a given view.
| other | View to exchange the content with. |
Definition at line 203 of file runtime_view.hpp.