EnTT 3.13.1
|
Storage view specialization. More...
#include <view.hpp>
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 | iterator = typename base_type::iterator |
Random access iterator type. | |
using | reverse_iterator = typename base_type::reverse_iterator |
Reversed iterator type. | |
using | iterable = decltype(std::declval<Get>().each()) |
Iterable view type. | |
![]() | |
using | common_type |
Common type among all storage types. | |
using | entity_type |
Underlying entity identifier. | |
using | size_type |
Unsigned integer type. | |
using | iterator |
Random access iterator type. | |
using | reverse_iterator |
Reversed iterator type. | |
Public Member Functions | |
basic_view () noexcept | |
Default constructor to use to create empty, invalid views. | |
basic_view (Get &value) noexcept | |
Constructs a view from a storage class. | |
basic_view (std::tuple< Get & > value, std::tuple<>={}) noexcept | |
Constructs a view from a storage class. | |
template<typename Type = typename Get::value_type> | |
auto * | storage () const noexcept |
Returns the storage for a given component type, if any. | |
template<std::size_t Index> | |
auto * | storage () const noexcept |
Returns the storage for a given index, if any. | |
void | storage (Get &elem) noexcept |
Assigns a storage to a view. | |
template<std::size_t Index> | |
void | storage (Get &elem) noexcept |
Assigns a storage to a view. | |
decltype(auto) | operator[] (const entity_type entt) const |
Returns the component assigned to the given entity. | |
entity_type | operator[] (const size_type pos) const |
Returns the identifier that occupies the given position. | |
template<typename Elem > | |
decltype(auto) | get (const entity_type entt) const |
Returns the component assigned to the given entity. | |
template<std::size_t... Index> | |
decltype(auto) | get (const entity_type entt) const |
Returns the component assigned to the given entity. | |
template<typename Func > | |
void | each (Func func) const |
Iterates entities and components 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, typename... OExclude> | |
auto | operator| (const basic_view< get_t< OGet... >, exclude_t< OExclude... > > &other) const noexcept |
Combines two views in a more specific one. | |
![]() | |
const common_type * | handle () const noexcept |
Returns the leading storage of a view, if any. | |
size_type | size () const noexcept |
Returns the number of entities that have the given component. | |
bool | empty () const noexcept |
Checks whether a view is empty. | |
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. | |
reverse_iterator | rbegin () const noexcept |
Returns an iterator to the first entity of the reversed view. | |
reverse_iterator | rend () const noexcept |
Returns an iterator that is past the last entity of the reversed 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. | |
Storage view specialization.
This specialization offers a boost in terms of performance. It can access the underlying data structure directly and avoid superfluous checks.
Get | Type of storage iterated by the view. |
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::common_type = typename base_type::common_type |
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::entity_type = typename base_type::entity_type |
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::iterator = typename base_type::iterator |
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::reverse_iterator = typename base_type::reverse_iterator |
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::size_type = typename base_type::size_type |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Returns an iterable object to use to visit a view.
The iterable object returns a tuple that contains the current entity and a reference to its component if it's a non-empty one. The constness of the component is as requested.
|
inline |
Iterates entities and components 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):
Func | Type of the function object to invoke. |
func | A valid function object. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |