|
| view_pack (const Head &first, const Tail &... last) |
| Constructs a pack from a bunch of views. More...
|
|
iterator | begin () const ENTT_NOEXCEPT |
| Returns an iterator to the first entity of the pack. More...
|
|
iterator | end () const ENTT_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 ENTT_NOEXCEPT |
| Returns an iterable object to use to visit the pack. More...
|
|
std::tuple< Head, Tail... > | pack () const ENTT_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. |
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. |
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.