EnTT: entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> > Class Template Reference

EnTT 3.15.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> > Class Template Reference

General purpose view. More...

`#include <view.hpp>`

Inheritance diagram for entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >:
[legend]
Collaboration diagram for entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >:
[legend]

## Public Types
using | common_type = typename base_type::common_type
| Common type among all storage types.
using | entity_type = typename base_type::entity_type
| Underlying entity identifier.
using | size_type = typename base_type::size_type
| Unsigned integer type.
using | difference_type = std::ptrdiff_t
| Signed integer type.
using | iterator = typename base_type::iterator
| Forward iterator type.
using | iterable = iterable_adaptor<internal::extended_view_iterator<iterator, Get...>>
| Iterable view type.
Public Types inherited from entt::basic_common_view< std::common_type_t< Get::base_type... >, internal::tombstone_check_v< Get... >, sizeof...(Get), sizeof...(Exclude)>
using | common_type
| Common type among all storage types.
using | entity_type
| Underlying entity identifier.
using | size_type
| Unsigned integer type.
using | difference_type
| Signed integer type.
using | iterator
| Forward iterator type.

## Public Member Functions
| basic_view () noexcept
| Default constructor to use to create empty, invalid views.
| basic_view (Get &...value, Exclude &...excl) noexcept
| Constructs a view from a set of storage classes.
| basic_view (std::tuple< Get &... > value, std::tuple< Exclude &... > excl={}) noexcept
| Constructs a view from a set of storage classes.
template<typename Type>
void | use () noexcept
| Forces a view to use a given element to drive iterations.
template<std::size_t Index>
void | use () noexcept
| Forces a view to use a given element to drive iterations.
template<typename Type>
auto * | storage () const noexcept
| Returns the storage for a given element type, if any.
template<std::size_t Index>
auto * | storage () const noexcept
| Returns the storage for a given index, if any.
template<typename Type>
void | storage (Type &elem) noexcept
| Assigns a storage to a view.
template<std::size_t Index, typename Type>
void | storage (Type &elem) noexcept
| Assigns a storage to a view.
decltype(auto) | operator[] (const entity_type entt) const
| Returns the elements assigned to the given entity.
template<typename Type, typename... Other>
decltype(auto) | get (const entity_type entt) const
| Returns the elements assigned to the given entity.
template<std::size_t... Index>
decltype(auto) | get (const entity_type entt) const
| Returns the elements assigned to the given entity.
template<typename Func>
void | each (Func func) const
| Iterates entities and elements and applies the given function object to them.
iterable | each () const noexcept
| Returns an iterable object to use to visit a view.
template<typename OGet>
std::enable_if_t< std::is_base_of_v< common_type, OGet >, basic_view< get_t< Get..., OGet >, exclude_t< Exclude... > > > | operator| (OGet &other) const noexcept
| Combines a view and a storage in more specific view.
template<typename... OGet, typename... OExclude>
auto | operator| (const basic_view< get_t< OGet... >, exclude_t< OExclude... > > &other) const noexcept
| Combines two views in a more specific one.
Public Member Functions inherited from entt::basic_common_view< std::common_type_t< Get::base_type... >, internal::tombstone_check_v< Get... >, sizeof...(Get), sizeof...(Exclude)>
void | refresh () noexcept
| Updates the internal leading view if required.
const common_type * | handle () const noexcept
| Returns the leading storage of a view, if any.
size_type | size_hint () const noexcept
| Estimates the number of entities iterated by the view.
iterator | begin () const noexcept
| Returns an iterator to the first entity of the view.
iterator | end () const noexcept
| Returns an iterator that is past the last entity of the view.
entity_type | front () const noexcept
| Returns the first entity of the view, if any.
entity_type | back () const noexcept
| Returns the last entity of the view, if any.
iterator | find (const entity_type entt) const noexcept
| Finds an entity.
| operator bool () const noexcept
| Checks if a view is fully initialized.
bool | contains (const entity_type entt) const noexcept
| Checks if a view contains an entity.

## Detailed Description

template<typename... Get, typename... Exclude>
class entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >

General purpose view.

This view visits all entities that are at least in the given storage. During initialization, it also looks at the number of elements available for each storage and uses the smallest set in order to get a performance boost.

See also
  basic_view

Template Parameters

  Get | Types of storage iterated by the view.
  Exclude | Types of storage used to filter the view.

Definition at line 432 of file view.hpp.

## Member Typedef Documentation

## ◆ common_type

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::common_type = typename base_type::common_type

Common type among all storage types.

Definition at line 478 of file view.hpp.

## ◆ difference_type

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::difference_type = std::ptrdiff_t

Signed integer type.

Definition at line 484 of file view.hpp.

## ◆ entity_type

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::entity_type = typename base_type::entity_type

Underlying entity identifier.

Definition at line 480 of file view.hpp.

## ◆ iterable

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::iterable = iterable_adaptor<internal::extended_view_iterator<iterator, Get...>>

Iterable view type.

Definition at line 488 of file view.hpp.

## ◆ iterator

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::iterator = typename base_type::iterator

Forward iterator type.

Definition at line 486 of file view.hpp.

## ◆ size_type

template<typename... Get, typename... Exclude>

using entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::size_type = typename base_type::size_type

Unsigned integer type.

Definition at line 482 of file view.hpp.

## Constructor & Destructor Documentation

## ◆ basic_view() [1/3]

template<typename... Get, typename... Exclude>

entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::basic_view | ( |  | ) |
| inlinenoexcept

Default constructor to use to create empty, invalid views.

Definition at line 491 of file view.hpp.

## ◆ basic_view() [2/3]

template<typename... Get, typename... Exclude>

entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::basic_view | ( | Get &... | value,
|  | Exclude &... | excl )
| inlinenoexcept

Constructs a view from a set of storage classes.

Parameters

  value | The storage for the types to iterate.
  excl | The storage for the types used to filter the view.

Definition at line 499 of file view.hpp.

## ◆ basic_view() [3/3]

template<typename... Get, typename... Exclude>

entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::basic_view | ( | std::tuple< Get &... > | value,
|  | std::tuple< Exclude &... > | excl = {} )
| inlinenoexcept

Constructs a view from a set of storage classes.

Parameters

  value | The storage for the types to iterate.
  excl | The storage for the types used to filter the view.

Definition at line 508 of file view.hpp.

## Member Function Documentation

## ◆ each() [1/2]

template<typename... Get, typename... Exclude>

iterable entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::each | ( |  | ) | const
| inlinenodiscardnoexcept

Returns an iterable object to use to visit a view.

The iterable object returns a tuple that contains the current entity and a set of references to its non-empty elements. The constness of the elements is as requested.

Returns
  An iterable object to use to visit the view.

Definition at line 647 of file view.hpp.

## ◆ each() [2/2]

template<typename... Get, typename... Exclude>
template<typename Func>

void entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::each | ( | Func | func | ) | const
| inline

Iterates entities and elements and applies the given function object to them.

The signature of the function must be equivalent to one of the following (non-empty types only, constness as requested):

void(const entity_type, Type &...);
void(Type &...);
entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::entity_type
typename base_type::entity_type entity_type
Underlying entity identifier.
Definition view.hpp:480

Template Parameters

  Func | Type of the function object to invoke.

Parameters

  func | A valid function object.

Definition at line 634 of file view.hpp.

## ◆ get() [1/2]

template<typename... Get, typename... Exclude>
template<typename Type, typename... Other>

decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::get | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the elements assigned to the given entity.

Template Parameters

  Type | Type of the element to get.
  Other | Other types of elements to get.

Parameters

  entt | A valid identifier.

Returns
  The elements assigned to the entity.

Definition at line 597 of file view.hpp.

## ◆ get() [2/2]

template<typename... Get, typename... Exclude>
template<std::size_t... Index>

decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::get | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the elements assigned to the given entity.

Template Parameters

  Index | Indexes of the elements to get.

Parameters

  entt | A valid identifier.

Returns
  The elements assigned to the entity.

Definition at line 608 of file view.hpp.

## ◆ operator[]()

template<typename... Get, typename... Exclude>

decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::operator[] | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the elements assigned to the given entity.

Parameters

  entt | A valid identifier.

Returns
  The elements assigned to the given entity.

Definition at line 585 of file view.hpp.

## ◆ operator|() [1/2]

template<typename... Get, typename... Exclude>
template<typename... OGet, typename... OExclude>

auto entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::operator| | ( | const basic_view< get_t< OGet... >, exclude_t< OExclude... > > & | other | ) | const
| inlinenodiscardnoexcept

Combines two views in a more specific one.

Template Parameters

  OGet | Element list of the view to combine with.
  OExclude | Filter list of the view to combine with.

Parameters

  other | The view to combine with.

Returns
  A more specific view.

Definition at line 670 of file view.hpp.

## ◆ operator|() [2/2]

template<typename... Get, typename... Exclude>
template<typename OGet>

std::enable_if_t< std::is_base_of_v< common_type, OGet >, basic_view< get_t< Get..., OGet >, exclude_t< Exclude... > > > entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::operator| | ( | OGet & | other | ) | const
| inlinenodiscardnoexcept

Combines a view and a storage in more specific view.

Template Parameters

  OGet | Type of storage to combine the view with.

Parameters

  other | The storage for the type to combine the view with.

Returns
  A more specific view.

Definition at line 658 of file view.hpp.

## ◆ storage() [1/4]

template<typename... Get, typename... Exclude>
template<typename Type>

auto * entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::storage | ( |  | ) | const
| inlinenodiscardnoexcept

Returns the storage for a given element type, if any.

Template Parameters

  Type | Type of element of which to return the storage.

Returns
  The storage for the given element type.

Definition at line 535 of file view.hpp.

## ◆ storage() [2/4]

template<typename... Get, typename... Exclude>
template<std::size_t Index>

auto * entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::storage | ( |  | ) | const
| inlinenodiscardnoexcept

Returns the storage for a given index, if any.

Template Parameters

  Index | Index of the storage to return.

Returns
  The storage for the given index.

Definition at line 545 of file view.hpp.

## ◆ storage() [3/4]

template<typename... Get, typename... Exclude>
template<typename Type>

void entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::storage | ( | Type & | elem | ) |
| inlinenoexcept

Assigns a storage to a view.

Template Parameters

  Type | Type of storage to assign to the view.

Parameters

  elem | A storage to assign to the view.

Definition at line 559 of file view.hpp.

## ◆ storage() [4/4]

template<typename... Get, typename... Exclude>
template<std::size_t Index, typename Type>

void entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::storage | ( | Type & | elem | ) |
| inlinenoexcept

Assigns a storage to a view.

Template Parameters

  Index | Index of the storage to assign to the view.
  Type | Type of storage to assign to the view.

Parameters

  elem | A storage to assign to the view.

Definition at line 570 of file view.hpp.

## ◆ use() [1/2]

template<typename... Get, typename... Exclude>
template<typename Type>

void entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::use | ( |  | ) |
| inlinenoexcept

Forces a view to use a given element to drive iterations.

Template Parameters

  Type | Type of element to use to drive iterations.

Definition at line 516 of file view.hpp.

## ◆ use() [2/2]

template<typename... Get, typename... Exclude>
template<std::size_t Index>

void entt::basic_view< get_t< Get... >, exclude_t< Exclude... >, std::enable_if_t<(sizeof...(Get) !=0u)> >::use | ( |  | ) |
| inlinenoexcept

Forces a view to use a given element to drive iterations.

Template Parameters

  Index | Index of the element to use to drive iterations.

Definition at line 525 of file view.hpp.

The documentation for this class was generated from the following file:

- src/entt/entity/view.hpp