EnTT: entt::basic_view< get_t< Get >, exclude_t<> > 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<> > Class Template Reference

Storage view specialization. More...

`#include <view.hpp>`

Inheritance diagram for entt::basic_view< get_t< Get >, exclude_t<> >:
[legend]
Collaboration diagram for entt::basic_view< get_t< Get >, exclude_t<> >:
[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
| Random access iterator type.
using | reverse_iterator = typename base_type::reverse_iterator
| Reverse iterator type.
using | iterable = std::conditional_t<Get::storage_policy == deletion_policy::in_place, iterable_adaptor<internal::extended_view_iterator<iterator, Get>>, decltype(std::declval<Get>().each())>
| Iterable view type.
Public Types inherited from entt::basic_storage_view< Get::base_type, Get::storage_policy >
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
| Random access iterator type.
using | reverse_iterator
| Reverse 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::element_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.
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.
Get * | operator-> () const noexcept
| Returns a pointer to the underlying storage.
decltype(auto) | operator[] (const entity_type entt) const
| Returns the element assigned to the given entity.
template<typename Elem>
decltype(auto) | get (const entity_type entt) const
| Returns the element assigned to the given entity.
template<std::size_t... Index>
decltype(auto) | get (const entity_type entt) const
| Returns the element 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<> > > | 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_storage_view< Get::base_type, Get::storage_policy >
const common_type * | handle () const noexcept
| Returns the leading storage of a view, if any.
std::enable_if_t< Pol !=deletion_policy::in_place, size_type > | size () const noexcept
| Returns the number of entities that have the given element.
std::enable_if_t< Pol==deletion_policy::in_place, size_type > | size_hint () const noexcept
| Estimates the number of entities iterated by the view.
std::enable_if_t< Pol !=deletion_policy::in_place, 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.
std::enable_if_t< Pol !=deletion_policy::in_place, reverse_iterator > | rbegin () const noexcept
| Returns an iterator to the first entity of the reversed view.
std::enable_if_t< Pol !=deletion_policy::in_place, 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<> >

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

  Get | Type of storage iterated by the view.

Definition at line 912 of file view.hpp.

## Member Typedef Documentation

## ◆ common_type

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::common_type = typename base_type::common_type

Common type among all storage types.

Definition at line 918 of file view.hpp.

## ◆ difference_type

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::difference_type = std::ptrdiff_t

Signed integer type.

Definition at line 924 of file view.hpp.

## ◆ entity_type

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::entity_type = typename base_type::entity_type

Underlying entity identifier.

Definition at line 920 of file view.hpp.

## ◆ iterable

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::iterable = std::conditional_t<Get::storage_policy == deletion_policy::in_place, iterable_adaptor<internal::extended_view_iterator<iterator, Get>>, decltype(std::declval<Get>().each())>

Iterable view type.

Definition at line 930 of file view.hpp.

## ◆ iterator

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::iterator = typename base_type::iterator

Random access iterator type.

Definition at line 926 of file view.hpp.

## ◆ reverse_iterator

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::reverse_iterator = typename base_type::reverse_iterator

Reverse iterator type.

Definition at line 928 of file view.hpp.

## ◆ size_type

template<typename Get>

using entt::basic_view< get_t< Get >, exclude_t<> >::size_type = typename base_type::size_type

Unsigned integer type.

Definition at line 922 of file view.hpp.

## Constructor & Destructor Documentation

## ◆ basic_view() [1/3]

template<typename Get>

entt::basic_view< get_t< Get >, exclude_t<> >::basic_view | ( |  | ) |
| inlinenoexcept

Default constructor to use to create empty, invalid views.

Definition at line 933 of file view.hpp.

## ◆ basic_view() [2/3]

template<typename Get>

entt::basic_view< get_t< Get >, exclude_t<> >::basic_view | ( | Get & | value | ) |
| inlinenoexcept

Constructs a view from a storage class.

Parameters

  value | The storage for the type to iterate.

Definition at line 940 of file view.hpp.

## ◆ basic_view() [3/3]

template<typename Get>

entt::basic_view< get_t< Get >, exclude_t<> >::basic_view | ( | std::tuple< Get & > | value,
|  | std::tuple<> | = {} )
| inlinenoexcept

Constructs a view from a storage class.

Parameters

  value | The storage for the type to iterate.

Definition at line 948 of file view.hpp.

## Member Function Documentation

## ◆ each() [1/2]

template<typename Get>

iterable entt::basic_view< get_t< Get >, exclude_t<> >::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 reference to its element if it's a non-empty one. The constness of the element is as requested.

Returns
  An iterable object to use to visit the view.

Definition at line 1087 of file view.hpp.

## ◆ each() [2/2]

template<typename Get>
template<typename Func>

void entt::basic_view< get_t< Get >, exclude_t<> >::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(typename Type &);
entt::basic_view< get_t< Get >, exclude_t<> >::entity_type
typename base_type::entity_type entity_type
Underlying entity identifier.
Definition view.hpp:920

Template Parameters

  Func | Type of the function object to invoke.

Parameters

  func | A valid function object.

Definition at line 1052 of file view.hpp.

## ◆ get() [1/2]

template<typename Get>
template<typename Elem>

decltype(auto) entt::basic_view< get_t< Get >, exclude_t<> >::get | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the element assigned to the given entity.

Template Parameters

  Elem | Type of the element to get.

Parameters

  entt | A valid identifier.

Returns
  The element assigned to the entity.

Definition at line 1016 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<> >::get | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the element assigned to the given entity.

Template Parameters

  Index | Index of the element to get.

Parameters

  entt | A valid identifier.

Returns
  The element assigned to the entity.

Definition at line 1028 of file view.hpp.

## ◆ operator->()

template<typename Get>

Get * entt::basic_view< get_t< Get >, exclude_t<> >::operator-> | ( |  | ) | const
| inlinenodiscardnoexcept

Returns a pointer to the underlying storage.

Returns
  A pointer to the underlying storage.

Definition at line 996 of file view.hpp.

## ◆ operator[]()

template<typename Get>

decltype(auto) entt::basic_view< get_t< Get >, exclude_t<> >::operator[] | ( | const entity_type | entt | ) | const
| inlinenodiscard

Returns the element assigned to the given entity.

Parameters

  entt | A valid identifier.

Returns
  The element assigned to the given entity.

Definition at line 1005 of file view.hpp.

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

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

auto entt::basic_view< get_t< Get >, exclude_t<> >::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 1115 of file view.hpp.

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

template<typename Get>
template<typename OGet>

std::enable_if_t< std::is_base_of_v< common_type, OGet >, basic_view< get_t< Get, OGet >, exclude_t<> > > entt::basic_view< get_t< Get >, exclude_t<> >::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 1103 of file view.hpp.

## ◆ storage() [1/4]

template<typename Get>
template<typename Type = typename Get::element_type>

auto * entt::basic_view< get_t< Get >, exclude_t<> >::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 957 of file view.hpp.

## ◆ storage() [2/4]

template<typename Get>
template<std::size_t Index>

auto * entt::basic_view< get_t< Get >, exclude_t<> >::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 968 of file view.hpp.

## ◆ storage() [3/4]

template<typename Get>

void entt::basic_view< get_t< Get >, exclude_t<> >::storage | ( | Get & | elem | ) |
| inlinenoexcept

Assigns a storage to a view.

Parameters

  elem | A storage to assign to the view.

Definition at line 977 of file view.hpp.

## ◆ storage() [4/4]

template<typename Get>
template<std::size_t Index>

void entt::basic_view< get_t< Get >, exclude_t<> >::storage | ( | Get & | elem | ) |
| inlinenoexcept

Assigns a storage to a view.

Template Parameters

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

Parameters

  elem | A storage to assign to the view.

Definition at line 987 of file view.hpp.

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

- src/entt/entity/view.hpp