EnTT 3.13.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > > Class Template Reference

Storage view specialization. More...

#include <view.hpp>

Inheritance diagram for entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >:
Inheritance graph
[legend]
Collaboration diagram for entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >:
Collaboration graph
[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 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.
 
- Public Types inherited from entt::basic_storage_view< Get::base_type >
using common_type = Get::base_type
 Common type among all storage types.
 
using entity_type = typename common_type::entity_type
 Underlying entity identifier.
 
using size_type = std::size_t
 Unsigned integer type.
 
using iterator = typename common_type::iterator
 Random access iterator type.
 
using reverse_iterator = typename common_type::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.
 
- Public Member Functions inherited from entt::basic_storage_view< Get::base_type >
const common_typehandle () 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.
 

Detailed Description

template<typename Get>
class entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >

Storage view specialization.

This specialization offers a boost in terms of performance. It can access the underlying data structure directly and avoid superfluous checks.

See also
basic_view
Template Parameters
GetType of storage iterated by the view.

Definition at line 772 of file view.hpp.

Member Typedef Documentation

◆ common_type

template<typename Get >
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

Common type among all storage types.

Definition at line 777 of file view.hpp.

◆ entity_type

template<typename Get >
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

Underlying entity identifier.

Definition at line 779 of file view.hpp.

◆ iterable

template<typename Get >
using entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::iterable = decltype(std::declval<Get>().each())

Iterable view type.

Definition at line 787 of file view.hpp.

◆ iterator

template<typename Get >
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

Random access iterator type.

Definition at line 783 of file view.hpp.

◆ reverse_iterator

template<typename Get >
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

Reversed iterator type.

Definition at line 785 of file view.hpp.

◆ size_type

template<typename Get >
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

Unsigned integer type.

Definition at line 781 of file view.hpp.

Constructor & Destructor Documentation

◆ basic_view() [1/3]

template<typename Get >
entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::basic_view ( )
inlinenoexcept

Default constructor to use to create empty, invalid views.

Definition at line 790 of file view.hpp.

◆ basic_view() [2/3]

template<typename Get >
entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::basic_view ( Get &  value)
inlinenoexcept

Constructs a view from a storage class.

Parameters
valueThe storage for the type to iterate.

Definition at line 797 of file view.hpp.

◆ basic_view() [3/3]

template<typename Get >
entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::basic_view ( std::tuple< Get & >  value,
std::tuple<>  = {} 
)
inlinenoexcept

Constructs a view from a storage class.

Parameters
valueThe storage for the type to iterate.

Definition at line 805 of file view.hpp.

Member Function Documentation

◆ each() [1/2]

template<typename Get >
iterable entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::each ( ) const
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.

Returns
An iterable object to use to visit the view.

Definition at line 937 of file view.hpp.

◆ each() [2/2]

template<typename Get >
template<typename Func >
void entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::each ( Func  func) const
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):

void(const entity_type, Type &);
void(typename Type &);
Template Parameters
FuncType of the function object to invoke.
Parameters
funcA valid function object.

Definition at line 910 of file view.hpp.

◆ get() [1/2]

template<typename Get >
template<typename Elem >
decltype(auto) entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::get ( const entity_type  entt) const
inline

Returns the component assigned to the given entity.

Template Parameters
ElemType of the component to get.
Parameters
enttA valid identifier.
Returns
The component assigned to the entity.

Definition at line 874 of file view.hpp.

◆ get() [2/2]

template<typename Get >
template<std::size_t... Index>
decltype(auto) entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::get ( const entity_type  entt) const
inline

Returns the component assigned to the given entity.

Template Parameters
IndexIndex of the component to get.
Parameters
enttA valid identifier.
Returns
The component assigned to the entity.

Definition at line 886 of file view.hpp.

◆ operator[]() [1/2]

template<typename Get >
decltype(auto) entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::operator[] ( const entity_type  entt) const
inline

Returns the component assigned to the given entity.

Parameters
enttA valid identifier.
Returns
The component assigned to the given entity.

Definition at line 854 of file view.hpp.

◆ operator[]() [2/2]

template<typename Get >
entity_type entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::operator[] ( const size_type  pos) const
inline

Returns the identifier that occupies the given position.

Parameters
posPosition of the element to return.
Returns
The identifier that occupies the given position.

Definition at line 863 of file view.hpp.

◆ operator|()

template<typename Get >
template<typename... OGet, typename... OExclude>
auto entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::operator| ( const basic_view< get_t< OGet... >, exclude_t< OExclude... > > &  other) const
inlinenoexcept

Combines two views in a more specific one.

Template Parameters
OGetComponent list of the view to combine with.
OExcludeFilter list of the view to combine with.
Parameters
otherThe view to combine with.
Returns
A more specific view.

Definition at line 950 of file view.hpp.

◆ storage() [1/4]

template<typename Get >
template<typename Type = typename Get::value_type>
auto * entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::storage ( ) const
inlinenoexcept

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

Template Parameters
TypeType of component of which to return the storage.
Returns
The storage for the given component type.

Definition at line 814 of file view.hpp.

◆ storage() [2/4]

template<typename Get >
template<std::size_t Index>
auto * entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::storage ( ) const
inlinenoexcept

Returns the storage for a given index, if any.

Template Parameters
IndexIndex of the storage to return.
Returns
The storage for the given index.

Definition at line 825 of file view.hpp.

◆ storage() [3/4]

template<typename Get >
void entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::storage ( Get &  elem)
inlinenoexcept

Assigns a storage to a view.

Parameters
elemA storage to assign to the view.

Definition at line 834 of file view.hpp.

◆ storage() [4/4]

template<typename Get >
template<std::size_t Index>
void entt::basic_view< get_t< Get >, exclude_t<>, std::void_t< std::enable_if_t<!Get::traits_type::in_place_delete > > >::storage ( Get &  elem)
inlinenoexcept

Assigns a storage to a view.

Template Parameters
IndexIndex of the storage to assign to the view.
Parameters
elemA storage to assign to the view.

Definition at line 844 of file view.hpp.


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