|
| view_pack (const Head &first, const Tail &... last) |
| Constructs a pack from a bunch of views. More...
|
|
iterator | begin () const noexcept |
| Returns an iterator to the first entity of the pack. More...
|
|
iterator | end () const noexcept |
| Returns an iterator that is past the last entity of the pack. More...
|
|
reverse_iterator | rbegin () const |
| Returns an iterator to the first entity of the pack. More...
|
|
reverse_iterator | rend () const |
| Returns an iterator that is past the last entity of the reversed pack. More...
|
|
entity_type | front () const |
| Returns the first entity of the pack, if any. More...
|
|
entity_type | back () const |
| Returns the last entity of the pack, if any. More...
|
|
iterator | find (const entity_type entt) const |
| Finds an entity. More...
|
|
bool | contains (const entity_type entt) const |
| Checks if a pack contains an entity. More...
|
|
template<typename... Comp> |
decltype(auto) | get ([[maybe_unused]] const entity_type entt) const |
| Returns the components assigned to the given entity. More...
|
|
template<typename Func > |
void | each (Func func) const |
| Iterates entities and components and applies the given function object to them. More...
|
|
iterable_view_pack | each () const noexcept |
| Returns an iterable object to use to visit the pack. More...
|
|
std::tuple< Head, Tail... > | pack () const noexcept |
| Returns a copy of the views stored by the pack. More...
|
|
template<typename... Args> |
auto | operator| (const basic_view< Args... > &other) const |
| Appends a view to a pack. More...
|
|
template<typename... Pack> |
auto | operator| (const view_pack< Pack... > &other) const |
| Appends a pack and therefore all its views to another pack. More...
|
|
template<typename Head, typename... Tail>
class entt::view_pack< Head, Tail >
View pack.
The view pack allows users to combine multiple views into a single iterable object, while also giving them full control over which view should lead the iteration.
This class returns all and only the entities present in all views. Its intended primary use is for custom storage and views, but it can also be very convenient in everyday use.
- Template Parameters
-
Head | Type of the leading view of the pack. |
Tail | Types of all other views of the pack. |
Definition at line 31 of file view_pack.hpp.
template<typename Head , typename... Tail>
Returns an iterator to the first entity of the pack.
The returned iterator points to the first entity of the pack. If the pack is empty, the returned iterator will be equal to end()
.
- Returns
- An iterator to the first entity of the pack.
Definition at line 201 of file view_pack.hpp.
template<typename Head , typename... Tail>
Returns an iterable object to use to visit the pack.
The iterable object returns tuples that contain the current entity and a set of references to its non-empty components. The constness of the components is as requested.
- Note
- Empty types aren't explicitly instantiated and therefore they are never returned during iterations.
- Returns
- An iterable object to use to visit the pack.
Definition at line 364 of file view_pack.hpp.
template<typename Head , typename... Tail>
template<typename Func >
Iterates entities and components and applies the given function object to them.
The function object is invoked for each entity. It is provided with the entity itself and a set of references to non-empty components. The constness of the components is as requested.
The signature of the function must be equivalent to one of the following forms:
- Note
- Empty types aren't explicitly instantiated and therefore they are never returned during iterations.
- Template Parameters
-
Func | Type of the function object to invoke. |
- Parameters
-
func | A valid function object. |
Definition at line 337 of file view_pack.hpp.
template<typename Head , typename... Tail>
Returns an iterator that is past the last entity of the pack.
The returned iterator points to the entity following the last entity of the pack. Attempting to dereference the returned iterator results in undefined behavior.
- Returns
- An iterator to the entity following the last entity of the pack.
Definition at line 214 of file view_pack.hpp.
template<typename Head , typename... Tail>
template<typename... Comp>
Returns the components assigned to the given entity.
Prefer this function instead of registry::get
during iterations. It has far better performance than its counterpart.
- Warning
- Attempting to use an invalid component type results in a compilation error. Attempting to use an entity that doesn't belong to the pack results in undefined behavior.
- Template Parameters
-
Comp | Types of components to get. |
- Parameters
-
entt | A valid entity identifier. |
- Returns
- The components assigned to the entity.
Definition at line 301 of file view_pack.hpp.
template<typename Head , typename... Tail>
Returns an iterator that is past the last entity of the reversed pack.
The returned iterator points to the entity following the last entity of the reversed pack. Attempting to dereference the returned iterator results in undefined behavior.
- Returns
- An iterator to the entity following the last entity of the reversed pack.
Definition at line 241 of file view_pack.hpp.