EnTT 3.13.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
entt::basic_storage< Type, Entity, Allocator, typename > Class Template Reference

Basic storage implementation. More...

#include <storage.hpp>

Inheritance diagram for entt::basic_storage< Type, Entity, Allocator, typename >:
Inheritance graph
[legend]
Collaboration diagram for entt::basic_storage< Type, Entity, Allocator, typename >:
Collaboration graph
[legend]

Public Types

using base_type = underlying_type
 Base type.
 
using value_type = Type
 Type of the objects assigned to entities.
 
using traits_type = component_traits< value_type >
 Component traits.
 
using entity_type = Entity
 Underlying entity identifier.
 
using size_type = std::size_t
 Unsigned integer type.
 
using allocator_type = Allocator
 Allocator type.
 
using pointer = typename container_type::pointer
 Pointer type to contained elements.
 
using const_pointer = typename alloc_traits::template rebind_traits< typename alloc_traits::const_pointer >::const_pointer
 Constant pointer type to contained elements.
 
using iterator = internal::storage_iterator< container_type, traits_type::page_size >
 Random access iterator type.
 
using const_iterator = internal::storage_iterator< const container_type, traits_type::page_size >
 Constant random access iterator type.
 
using reverse_iterator = std::reverse_iterator< iterator >
 Reverse iterator type.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 Constant reverse iterator type.
 
using iterable = iterable_adaptor< internal::extended_storage_iterator< typename base_type::iterator, iterator > >
 Extended iterable storage proxy.
 
using const_iterable = iterable_adaptor< internal::extended_storage_iterator< typename base_type::const_iterator, const_iterator > >
 Constant extended iterable storage proxy.
 
using reverse_iterable = iterable_adaptor< internal::extended_storage_iterator< typename base_type::reverse_iterator, reverse_iterator > >
 Extended reverse iterable storage proxy.
 
using const_reverse_iterable = iterable_adaptor< internal::extended_storage_iterator< typename base_type::const_reverse_iterator, const_reverse_iterator > >
 Constant extended reverse iterable storage proxy.
 
- Public Types inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
using traits_type = entt_traits< Entity >
 Entity traits.
 
using entity_type = typename traits_type::value_type
 Underlying entity identifier.
 
using version_type = typename traits_type::version_type
 Underlying version type.
 
using size_type = std::size_t
 Unsigned integer type.
 
using allocator_type = std::allocator_traits< Allocator >::template rebind_alloc< Entity >
 Allocator type.
 
using pointer = typename packed_container_type::const_pointer
 Pointer type to contained entities.
 
using iterator = basic_iterator
 Random access iterator type.
 
using const_iterator = iterator
 Constant random access iterator type.
 
using reverse_iterator = std::reverse_iterator< iterator >
 Reverse iterator type.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 Constant reverse iterator type.
 

Public Member Functions

 basic_storage ()
 Default constructor.
 
 basic_storage (const allocator_type &allocator)
 Constructs an empty storage with a given allocator.
 
 basic_storage (basic_storage &&other) noexcept
 Move constructor.
 
 basic_storage (basic_storage &&other, const allocator_type &allocator) noexcept
 Allocator-extended move constructor.
 
 ~basic_storage () override
 Default destructor.
 
basic_storageoperator= (basic_storage &&other) noexcept
 Move assignment operator.
 
void swap (basic_storage &other)
 Exchanges the contents with those of a given storage.
 
constexpr allocator_type get_allocator () const noexcept
 Returns the associated allocator.
 
void reserve (const size_type cap) override
 Increases the capacity of a storage.
 
size_type capacity () const noexcept override
 Returns the number of elements that a storage has currently allocated space for.
 
void shrink_to_fit () override
 Requests the removal of unused capacity.
 
const_pointer raw () const noexcept
 Direct access to the array of objects.
 
pointer raw () noexcept
 Direct access to the array of objects.
 
const_iterator cbegin () const noexcept
 Returns an iterator to the beginning.
 
const_iterator begin () const noexcept
 Returns an iterator to the beginning.
 
iterator begin () noexcept
 Returns an iterator to the beginning.
 
const_iterator cend () const noexcept
 Returns an iterator to the end.
 
const_iterator end () const noexcept
 Returns an iterator to the end.
 
iterator end () noexcept
 Returns an iterator to the end.
 
const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the end.
 
const_reverse_iterator rend () const noexcept
 Returns a reverse iterator to the end.
 
reverse_iterator rend () noexcept
 Returns a reverse iterator to the end.
 
const value_typeget (const entity_type entt) const noexcept
 Returns the object assigned to an entity.
 
value_typeget (const entity_type entt) noexcept
 Returns the object assigned to an entity.
 
std::tuple< const value_type & > get_as_tuple (const entity_type entt) const noexcept
 Returns the object assigned to an entity as a tuple.
 
std::tuple< value_type & > get_as_tuple (const entity_type entt) noexcept
 Returns the object assigned to an entity as a tuple.
 
template<typename... Args>
value_typeemplace (const entity_type entt, Args &&...args)
 Assigns an entity to a storage and constructs its object.
 
template<typename... Func>
value_typepatch (const entity_type entt, Func &&...func)
 Updates the instance assigned to a given entity in-place.
 
template<typename It >
iterator insert (It first, It last, const value_type &value={})
 Assigns one or more entities to a storage and constructs their objects from a given instance.
 
template<typename EIt , typename CIt , typename = std::enable_if_t<std::is_same_v<typename std::iterator_traits<CIt>::value_type, value_type>>>
iterator insert (EIt first, EIt last, CIt from)
 Assigns one or more entities to a storage and constructs their objects from a given range.
 
iterable each () noexcept
 Returns an iterable object to use to visit a storage.
 
const_iterable each () const noexcept
 Returns an iterable object to use to visit a storage.
 
reverse_iterable reach () noexcept
 Returns a reverse iterable object to use to visit a storage.
 
const_reverse_iterable reach () const noexcept
 Returns a reverse iterable object to use to visit a storage.
 
- Public Member Functions inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
 basic_sparse_set ()
 Default constructor.
 
 basic_sparse_set (const allocator_type &allocator)
 Constructs an empty container with a given allocator.
 
 basic_sparse_set (deletion_policy pol, const allocator_type &allocator={})
 Constructs an empty container with the given policy and allocator.
 
 basic_sparse_set (const type_info &elem, deletion_policy pol=deletion_policy::swap_and_pop, const allocator_type &allocator={})
 Constructs an empty container with the given value type, policy and allocator.
 
 basic_sparse_set (basic_sparse_set &&other) noexcept
 Move constructor.
 
 basic_sparse_set (basic_sparse_set &&other, const allocator_type &allocator) noexcept
 Allocator-extended move constructor.
 
virtual ~basic_sparse_set ()
 Default destructor.
 
basic_sparse_setoperator= (basic_sparse_set &&other) noexcept
 Move assignment operator.
 
void swap (basic_sparse_set &other)
 Exchanges the contents with those of a given sparse set.
 
constexpr allocator_type get_allocator () const noexcept
 Returns the associated allocator.
 
deletion_policy policy () const noexcept
 Returns the deletion policy of a sparse set.
 
size_type free_list () const noexcept
 Returns the head of the free list, if any.
 
void free_list (const size_type len) noexcept
 Sets the head of the free list, if possible.
 
virtual void reserve (const size_type cap)
 Increases the capacity of a sparse set.
 
virtual size_type capacity () const noexcept
 Returns the number of elements that a sparse set has currently allocated space for.
 
virtual void shrink_to_fit ()
 Requests the removal of unused capacity.
 
size_type extent () const noexcept
 Returns the extent of a sparse set.
 
size_type size () const noexcept
 Returns the number of elements in a sparse set.
 
bool empty () const noexcept
 Checks whether a sparse set is empty.
 
bool contiguous () const noexcept
 Checks whether a sparse set is fully packed.
 
pointer data () const noexcept
 Direct access to the internal packed array.
 
iterator begin () const noexcept
 Returns an iterator to the beginning.
 
iterator begin (int) const noexcept
 Returns an iterator to the beginning. Useful only in case of swap-only policy.
 
const_iterator cbegin () const noexcept
 Returns an iterator to the beginning.
 
const_iterator cbegin (int) const noexcept
 Returns an iterator to the beginning. Useful only in case of swap-only policy.
 
iterator end () const noexcept
 Returns an iterator to the end.
 
iterator end (int) const noexcept
 Returns an iterator to the end. Useful only in case of swap-only policy.
 
const_iterator cend () const noexcept
 Returns an iterator to the end.
 
const_iterator cend (int) const noexcept
 Returns an iterator to the end. Useful only in case of swap-only policy.
 
reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
reverse_iterator rbegin (int) const noexcept
 Returns a reverse iterator to the beginning. Useful only in case of swap-only policy.
 
const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator crbegin (int) const noexcept
 Returns a reverse iterator to the beginning. Useful only in case of swap-only policy.
 
reverse_iterator rend () const noexcept
 Returns a reverse iterator to the end.
 
reverse_iterator rend (int) const noexcept
 Returns a reverse iterator to the beginning. Useful only in case of swap-only policy.
 
const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the end.
 
const_reverse_iterator crend (int) const noexcept
 Returns a reverse iterator to the beginning. Useful only in case of swap-only policy.
 
const_iterator find (const entity_type entt) const noexcept
 Finds an entity.
 
bool contains (const entity_type entt) const noexcept
 Checks if a sparse set contains an entity.
 
version_type current (const entity_type entt) const noexcept
 Returns the contained version for an identifier.
 
size_type index (const entity_type entt) const noexcept
 Returns the position of an entity in a sparse set.
 
entity_type at (const size_type pos) const noexcept
 Returns the entity at specified location, with bounds checking.
 
entity_type operator[] (const size_type pos) const noexcept
 Returns the entity at specified location, without bounds checking.
 
const void * value (const entity_type entt) const noexcept
 Returns the element assigned to an entity, if any.
 
void * value (const entity_type entt) noexcept
 Returns the element assigned to an entity, if any.
 
iterator push (const entity_type entt, const void *elem=nullptr)
 Assigns an entity to a sparse set.
 
iterator push (It first, It last)
 Assigns one or more entities to a sparse set.
 
version_type bump (const entity_type entt)
 Bump the version number of an entity.
 
void erase (const entity_type entt)
 Erases an entity from a sparse set.
 
void erase (It first, It last)
 Erases entities from a set.
 
bool remove (const entity_type entt)
 Removes an entity from a sparse set if it exists.
 
size_type remove (It first, It last)
 Removes entities from a sparse set if they exist.
 
void compact ()
 Removes all tombstones from a sparse set.
 
void swap_elements (const entity_type lhs, const entity_type rhs)
 Swaps two entities in a sparse set.
 
void sort_n (const size_type length, Compare compare, Sort algo=Sort{}, Args &&...args)
 Sort the first count elements according to the given comparison function.
 
void sort (Compare compare, Sort algo=Sort{}, Args &&...args)
 Sort all elements according to the given comparison function.
 
void sort_as (It first, It last)
 Sort entities according to their order in a range.
 
void sort_as (const basic_sparse_set &other)
 Sort entities according to their order in a range.
 
void clear ()
 Clears a sparse set.
 
const type_infotype () const noexcept
 Returned value type, if any.
 
virtual void bind (any) noexcept
 Forwards variables to derived classes, if any.
 

Protected Member Functions

void pop (underlying_iterator first, underlying_iterator last) override
 Erases entities from a storage.
 
void pop_all () override
 Erases all entities of a storage.
 
underlying_iterator try_emplace (const Entity entt, const bool force_back, const void *value) override
 Assigns an entity to a storage.
 
- Protected Member Functions inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
void swap_only (const basic_iterator it)
 Erases an entity from a sparse set.
 
void swap_and_pop (const basic_iterator it)
 Erases an entity from a sparse set.
 
void in_place_pop (const basic_iterator it)
 Erases an entity from a sparse set.
 
virtual void pop (basic_iterator first, basic_iterator last)
 Erases entities from a sparse set.
 
virtual void pop_all ()
 Erases all entities of a sparse set.
 
virtual basic_iterator try_emplace (const Entity entt, const bool force_back, const void *=nullptr)
 Assigns an entity to a sparse set.
 

Additional Inherited Members

- Protected Types inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
using basic_iterator = internal::sparse_set_iterator< packed_container_type >
 Random access iterator type.
 

Detailed Description

template<typename Type, typename Entity, typename Allocator, typename>
class entt::basic_storage< Type, Entity, Allocator, typename >

Basic storage implementation.

Internal data structures arrange elements to maximize performance. There are no guarantees that objects are returned in the insertion order when iterate a storage. Do not make assumption on the order in any case.

Warning
Empty types aren't explicitly instantiated. Therefore, many of the functions normally available for non-empty types will not be available for empty ones.
Template Parameters
TypeType of objects assigned to the entities.
EntityA valid entity type.
AllocatorType of allocator used to manage memory and elements.

Definition at line 229 of file storage.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::allocator_type = Allocator

Allocator type.

Definition at line 402 of file storage.hpp.

◆ base_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::base_type = underlying_type

Base type.

Definition at line 392 of file storage.hpp.

◆ const_iterable

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::const_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::const_iterator, const_iterator> >

Constant extended iterable storage proxy.

Definition at line 418 of file storage.hpp.

◆ const_iterator

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::const_iterator = internal::storage_iterator<const container_type, traits_type::page_size>

Constant random access iterator type.

Definition at line 410 of file storage.hpp.

◆ const_pointer

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::const_pointer = typename alloc_traits::template rebind_traits<typename alloc_traits::const_pointer>::const_pointer

Constant pointer type to contained elements.

Definition at line 406 of file storage.hpp.

◆ const_reverse_iterable

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::const_reverse_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::const_reverse_iterator, const_reverse_iterator> >

Constant extended reverse iterable storage proxy.

Definition at line 422 of file storage.hpp.

◆ const_reverse_iterator

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Constant reverse iterator type.

Definition at line 414 of file storage.hpp.

◆ entity_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::entity_type = Entity

Underlying entity identifier.

Definition at line 398 of file storage.hpp.

◆ iterable

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::iterator, iterator> >

Extended iterable storage proxy.

Definition at line 416 of file storage.hpp.

◆ iterator

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::iterator = internal::storage_iterator<container_type, traits_type::page_size>

Random access iterator type.

Definition at line 408 of file storage.hpp.

◆ pointer

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::pointer = typename container_type::pointer

Pointer type to contained elements.

Definition at line 404 of file storage.hpp.

◆ reverse_iterable

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::reverse_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::reverse_iterator, reverse_iterator> >

Extended reverse iterable storage proxy.

Definition at line 420 of file storage.hpp.

◆ reverse_iterator

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::reverse_iterator = std::reverse_iterator<iterator>

Reverse iterator type.

Definition at line 412 of file storage.hpp.

◆ size_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::size_type = std::size_t

Unsigned integer type.

Definition at line 400 of file storage.hpp.

◆ traits_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::traits_type = component_traits<value_type>

Component traits.

Definition at line 396 of file storage.hpp.

◆ value_type

template<typename Type , typename Entity , typename Allocator , typename >
using entt::basic_storage< Type, Entity, Allocator, typename >::value_type = Type

Type of the objects assigned to entities.

Definition at line 394 of file storage.hpp.

Constructor & Destructor Documentation

◆ basic_storage() [1/4]

template<typename Type , typename Entity , typename Allocator , typename >
entt::basic_storage< Type, Entity, Allocator, typename >::basic_storage ( )
inline

Default constructor.

Definition at line 425 of file storage.hpp.

◆ basic_storage() [2/4]

template<typename Type , typename Entity , typename Allocator , typename >
entt::basic_storage< Type, Entity, Allocator, typename >::basic_storage ( const allocator_type allocator)
inlineexplicit

Constructs an empty storage with a given allocator.

Parameters
allocatorThe allocator to use.

Definition at line 432 of file storage.hpp.

◆ basic_storage() [3/4]

template<typename Type , typename Entity , typename Allocator , typename >
entt::basic_storage< Type, Entity, Allocator, typename >::basic_storage ( basic_storage< Type, Entity, Allocator, typename > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 440 of file storage.hpp.

◆ basic_storage() [4/4]

template<typename Type , typename Entity , typename Allocator , typename >
entt::basic_storage< Type, Entity, Allocator, typename >::basic_storage ( basic_storage< Type, Entity, Allocator, typename > &&  other,
const allocator_type allocator 
)
inlinenoexcept

Allocator-extended move constructor.

Parameters
otherThe instance to move from.
allocatorThe allocator to use.

Definition at line 449 of file storage.hpp.

◆ ~basic_storage()

template<typename Type , typename Entity , typename Allocator , typename >
entt::basic_storage< Type, Entity, Allocator, typename >::~basic_storage ( )
inlineoverride

Default destructor.

Definition at line 456 of file storage.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_iterator entt::basic_storage< Type, Entity, Allocator, typename >::begin ( ) const
inlinenoexcept

Returns an iterator to the beginning.

If the storage is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 548 of file storage.hpp.

◆ begin() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
iterator entt::basic_storage< Type, Entity, Allocator, typename >::begin ( )
inlinenoexcept

Returns an iterator to the beginning.

If the storage is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 553 of file storage.hpp.

◆ capacity()

template<typename Type , typename Entity , typename Allocator , typename >
size_type entt::basic_storage< Type, Entity, Allocator, typename >::capacity ( ) const
inlineoverridevirtualnoexcept

Returns the number of elements that a storage has currently allocated space for.

Returns
Capacity of the storage.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 512 of file storage.hpp.

◆ cbegin()

template<typename Type , typename Entity , typename Allocator , typename >
const_iterator entt::basic_storage< Type, Entity, Allocator, typename >::cbegin ( ) const
inlinenoexcept

Returns an iterator to the beginning.

If the storage is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 542 of file storage.hpp.

◆ cend()

template<typename Type , typename Entity , typename Allocator , typename >
const_iterator entt::basic_storage< Type, Entity, Allocator, typename >::cend ( ) const
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 563 of file storage.hpp.

◆ crbegin()

template<typename Type , typename Entity , typename Allocator , typename >
const_reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::crbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the beginning.

If the storage is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 584 of file storage.hpp.

◆ crend()

template<typename Type , typename Entity , typename Allocator , typename >
const_reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::crend ( ) const
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 603 of file storage.hpp.

◆ each() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_iterable entt::basic_storage< Type, Entity, Allocator, typename >::each ( ) const
inlinenoexcept

Returns an iterable object to use to visit a storage.

The iterable object returns a tuple that contains the current entity and a reference to its component.

Returns
An iterable object to use to visit the storage.

Definition at line 746 of file storage.hpp.

◆ each() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
iterable entt::basic_storage< Type, Entity, Allocator, typename >::each ( )
inlinenoexcept

Returns an iterable object to use to visit a storage.

The iterable object returns a tuple that contains the current entity and a reference to its component.

Returns
An iterable object to use to visit the storage.

Definition at line 741 of file storage.hpp.

◆ emplace()

template<typename Type , typename Entity , typename Allocator , typename >
template<typename... Args>
value_type & entt::basic_storage< Type, Entity, Allocator, typename >::emplace ( const entity_type  entt,
Args &&...  args 
)
inline

Assigns an entity to a storage and constructs its object.

Warning
Attempting to use an entity that already belongs to the storage results in undefined behavior.
Template Parameters
ArgsTypes of arguments to use to construct the object.
Parameters
enttA valid identifier.
argsParameters to use to construct an object for the entity.
Returns
A reference to the newly created object.

Definition at line 663 of file storage.hpp.

◆ end() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_iterator entt::basic_storage< Type, Entity, Allocator, typename >::end ( ) const
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 568 of file storage.hpp.

◆ end() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
iterator entt::basic_storage< Type, Entity, Allocator, typename >::end ( )
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 573 of file storage.hpp.

◆ get() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const value_type & entt::basic_storage< Type, Entity, Allocator, typename >::get ( const entity_type  entt) const
inlinenoexcept

Returns the object assigned to an entity.

Warning
Attempting to use an entity that doesn't belong to the storage results in undefined behavior.
Parameters
enttA valid identifier.
Returns
The object assigned to the entity.

Definition at line 627 of file storage.hpp.

◆ get() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
value_type & entt::basic_storage< Type, Entity, Allocator, typename >::get ( const entity_type  entt)
inlinenoexcept

Returns the object assigned to an entity.

Warning
Attempting to use an entity that doesn't belong to the storage results in undefined behavior.
Parameters
enttA valid identifier.
Returns
The object assigned to the entity.

Definition at line 632 of file storage.hpp.

◆ get_allocator()

template<typename Type , typename Entity , typename Allocator , typename >
constexpr allocator_type entt::basic_storage< Type, Entity, Allocator, typename >::get_allocator ( ) const
inlineconstexprnoexcept

Returns the associated allocator.

Returns
The associated allocator.

Definition at line 488 of file storage.hpp.

◆ get_as_tuple() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
std::tuple< const value_type & > entt::basic_storage< Type, Entity, Allocator, typename >::get_as_tuple ( const entity_type  entt) const
inlinenoexcept

Returns the object assigned to an entity as a tuple.

Parameters
enttA valid identifier.
Returns
The object assigned to the entity as a tuple.

Definition at line 641 of file storage.hpp.

◆ get_as_tuple() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
std::tuple< value_type & > entt::basic_storage< Type, Entity, Allocator, typename >::get_as_tuple ( const entity_type  entt)
inlinenoexcept

Returns the object assigned to an entity as a tuple.

Parameters
enttA valid identifier.
Returns
The object assigned to the entity as a tuple.

Definition at line 646 of file storage.hpp.

◆ insert() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
template<typename EIt , typename CIt , typename = std::enable_if_t<std::is_same_v<typename std::iterator_traits<CIt>::value_type, value_type>>>
iterator entt::basic_storage< Type, Entity, Allocator, typename >::insert ( EIt  first,
EIt  last,
CIt  from 
)
inline

Assigns one or more entities to a storage and constructs their objects from a given range.

See also
construct
Template Parameters
EItType of input iterator.
CItType of input iterator.
Parameters
firstAn iterator to the first element of the range of entities.
lastAn iterator past the last element of the range of entities.
fromAn iterator to the first element of the range of objects.
Returns
Iterator pointing to the first element inserted, if any.

Definition at line 725 of file storage.hpp.

◆ insert() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
template<typename It >
iterator entt::basic_storage< Type, Entity, Allocator, typename >::insert ( It  first,
It  last,
const value_type value = {} 
)
inline

Assigns one or more entities to a storage and constructs their objects from a given instance.

Warning
Attempting to assign an entity that already belongs to the storage results in undefined behavior.
Template Parameters
ItType of input iterator.
Parameters
firstAn iterator to the first element of the range of entities.
lastAn iterator past the last element of the range of entities.
valueAn instance of the object to construct.
Returns
Iterator pointing to the last element inserted, if any.

Definition at line 703 of file storage.hpp.

◆ operator=()

template<typename Type , typename Entity , typename Allocator , typename >
basic_storage & entt::basic_storage< Type, Entity, Allocator, typename >::operator= ( basic_storage< Type, Entity, Allocator, typename > &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This storage.

Definition at line 465 of file storage.hpp.

◆ patch()

template<typename Type , typename Entity , typename Allocator , typename >
template<typename... Func>
value_type & entt::basic_storage< Type, Entity, Allocator, typename >::patch ( const entity_type  entt,
Func &&...  func 
)
inline

Updates the instance assigned to a given entity in-place.

Template Parameters
FuncTypes of the function objects to invoke.
Parameters
enttA valid identifier.
funcValid function objects.
Returns
A reference to the updated instance.

Definition at line 681 of file storage.hpp.

◆ pop()

template<typename Type , typename Entity , typename Allocator , typename >
void entt::basic_storage< Type, Entity, Allocator, typename >::pop ( underlying_iterator  first,
underlying_iterator  last 
)
inlineoverrideprotectedvirtual

Erases entities from a storage.

Parameters
firstAn iterator to the first element of the range of entities.
lastAn iterator past the last element of the range of entities.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 332 of file storage.hpp.

◆ pop_all()

template<typename Type , typename Entity , typename Allocator , typename >
void entt::basic_storage< Type, Entity, Allocator, typename >::pop_all ( )
inlineoverrideprotectedvirtual

Erases all entities of a storage.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 351 of file storage.hpp.

◆ raw() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_pointer entt::basic_storage< Type, Entity, Allocator, typename >::raw ( ) const
inlinenoexcept

Direct access to the array of objects.

Returns
A pointer to the array of objects.

Definition at line 526 of file storage.hpp.

◆ raw() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
pointer entt::basic_storage< Type, Entity, Allocator, typename >::raw ( )
inlinenoexcept

Direct access to the array of objects.

Returns
A pointer to the array of objects.

Definition at line 531 of file storage.hpp.

◆ rbegin() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::rbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the beginning.

If the storage is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 589 of file storage.hpp.

◆ rbegin() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::rbegin ( )
inlinenoexcept

Returns a reverse iterator to the beginning.

If the storage is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 594 of file storage.hpp.

◆ reach() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_reverse_iterable entt::basic_storage< Type, Entity, Allocator, typename >::reach ( ) const
inlinenoexcept

Returns a reverse iterable object to use to visit a storage.

See also
each
Returns
A reverse iterable object to use to visit the storage.

Definition at line 762 of file storage.hpp.

◆ reach() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
reverse_iterable entt::basic_storage< Type, Entity, Allocator, typename >::reach ( )
inlinenoexcept

Returns a reverse iterable object to use to visit a storage.

See also
each
Returns
A reverse iterable object to use to visit the storage.

Definition at line 757 of file storage.hpp.

◆ rend() [1/2]

template<typename Type , typename Entity , typename Allocator , typename >
const_reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::rend ( ) const
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 608 of file storage.hpp.

◆ rend() [2/2]

template<typename Type , typename Entity , typename Allocator , typename >
reverse_iterator entt::basic_storage< Type, Entity, Allocator, typename >::rend ( )
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 613 of file storage.hpp.

◆ reserve()

template<typename Type , typename Entity , typename Allocator , typename >
void entt::basic_storage< Type, Entity, Allocator, typename >::reserve ( const size_type  cap)
inlineoverridevirtual

Increases the capacity of a storage.

If the new capacity is greater than the current capacity, new storage is allocated, otherwise the method does nothing.

Parameters
capDesired capacity.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 500 of file storage.hpp.

◆ shrink_to_fit()

template<typename Type , typename Entity , typename Allocator , typename >
void entt::basic_storage< Type, Entity, Allocator, typename >::shrink_to_fit ( )
inlineoverridevirtual

Requests the removal of unused capacity.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 517 of file storage.hpp.

◆ swap()

template<typename Type , typename Entity , typename Allocator , typename >
void entt::basic_storage< Type, Entity, Allocator, typename >::swap ( basic_storage< Type, Entity, Allocator, typename > &  other)
inline

Exchanges the contents with those of a given storage.

Parameters
otherStorage to exchange the content with.

Definition at line 478 of file storage.hpp.

◆ try_emplace()

template<typename Type , typename Entity , typename Allocator , typename >
underlying_iterator entt::basic_storage< Type, Entity, Allocator, typename >::try_emplace ( const Entity  entt,
const bool  force_back,
const void *  value 
)
inlineoverrideprotectedvirtual

Assigns an entity to a storage.

Parameters
enttA valid identifier.
valueOptional opaque value.
force_backForce back insertion.
Returns
Iterator pointing to the emplaced element.

Reimplemented from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >.

Definition at line 374 of file storage.hpp.


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