EnTT 3.16.0
Loading...
Searching...
No Matches
entt::basic_storage< Entity, Entity, Allocator > Class Template Reference

Swap-only entity storage specialization. More...

#include <storage.hpp>

Inheritance diagram for entt::basic_storage< Entity, Entity, Allocator >:
Collaboration diagram for entt::basic_storage< Entity, Entity, Allocator >:

Public Types

using allocator_type = Allocator
 Allocator type.
using base_type = basic_sparse_set<Entity, Allocator>
 Base type.
using element_type = Entity
 Element type.
using value_type = void
 Type of the objects assigned to entities.
using entity_type = Entity
 Underlying entity identifier.
using size_type = std::size_t
 Unsigned integer type.
using difference_type = std::ptrdiff_t
 Signed integer type.
using iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::iterator>>
 Extended iterable storage proxy.
using const_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::const_iterator>>
 Constant extended iterable storage proxy.
using reverse_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::reverse_iterator>>
 Extended reverse iterable storage proxy.
using const_reverse_iterable = iterable_adaptor<internal::extended_storage_iterator<typename base_type::const_reverse_iterator>>
 Constant extended reverse iterable storage proxy.
using pointer
 Pointer type to contained elements.
using const_pointer
 Constant pointer type to contained elements.
using iterator
 Random access iterator type.
using const_iterator
 Constant random access iterator type.
using reverse_iterator
 Reverse iterator type.
using const_reverse_iterator
 Constant reverse iterator type.
Public Types inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
using allocator_type
 Allocator type.
using entity_type
 Underlying entity identifier.
using version_type
 Underlying version type.
using size_type
 Unsigned integer type.
using difference_type
 Signed integer type.
using pointer
 Pointer type to contained entities.
using iterator
 Random access iterator type.
using const_iterator
 Constant random access iterator type.
using reverse_iterator
 Reverse iterator type.
using const_reverse_iterator
 Constant reverse iterator type.
Public Types inherited from entt::basic_sparse_set< Entity, Allocator >
using allocator_type = Allocator
 Allocator type.
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 difference_type = std::ptrdiff_t
 Signed integer 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 container with a given allocator.
 basic_storage (const basic_storage &)=delete
 Default copy constructor, deleted on purpose.
 basic_storage (basic_storage &&other) noexcept
 Move constructor.
 basic_storage (basic_storage &&other, const allocator_type &allocator)
 Allocator-extended move constructor.
 ~basic_storage () override=default
 Default destructor.
basic_storageoperator= (const basic_storage &)=delete
 Default copy assignment operator, deleted on purpose.
basic_storageoperator= (basic_storage &&other) noexcept
 Move assignment operator.
void swap (basic_storage &other) noexcept
 Exchanges the contents with those of a given storage.
void get (const entity_type entt) const noexcept
 Returns the object assigned to an entity, that is void.
std::tuple get_as_tuple (const entity_type entt) const noexcept
 Returns an empty tuple.
entity_type generate ()
 Creates a new identifier or recycles a destroyed one.
entity_type generate (const entity_type hint)
 Creates a new identifier or recycles a destroyed one.
template<typename It>
void generate (It first, It last)
 Assigns each element in a range an identifier.
template<typename... Func>
void patch (const entity_type entt, Func &&...func)
 Updates a given identifier.
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.
void start_from (const entity_type hint)
 Sets the starting identifier for generation.
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.
const_iterator cbegin () const noexcept
 Returns an iterator to the beginning.
const_iterator begin () const 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.
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.
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.
value_typeemplace (const entity_type entt, Args &&...args)
 Assigns an entity to a storage and constructs its object.
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.
Public Member Functions inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
 basic_sparse_set ()
 Default constructor.
virtual ~basic_sparse_set ()
 Default destructor.
basic_sparse_setoperator= (const basic_sparse_set &)=delete
 Default copy assignment operator, deleted on purpose.
void swap (basic_sparse_set &other) noexcept
 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 data on the free list whose meaning depends on the mode.
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.
const_iterator cbegin () const noexcept
iterator end () const noexcept
 Returns an iterator to the end.
const_iterator cend () const noexcept
reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the beginning.
const_reverse_iterator crbegin () const noexcept
reverse_iterator rend () const noexcept
 Returns a reverse iterator to the end.
const_reverse_iterator crend () const noexcept
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 operator[] (const size_type pos) const noexcept
 Returns the entity at specified location.
const void * value (const entity_type entt) const 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.
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.
bool remove (const entity_type entt)
 Removes an entity from a sparse set if it exists.
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.
iterator sort_as (It first, It last)
 Sort entities according to their order in a range.
void clear ()
 Clears a sparse set.
const type_infoinfo () const noexcept
 Returns a type info object for the value type, if any.
const type_infotype () const noexcept
void bind (Type &&value) noexcept
 Forwards variables to derived classes, if any.
Public Member Functions inherited from entt::basic_sparse_set< Entity, Allocator >
 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 (const basic_sparse_set &)=delete
 Default copy constructor, deleted on purpose.
 basic_sparse_set (basic_sparse_set &&other) noexcept
 Move constructor.
 basic_sparse_set (basic_sparse_set &&other, const allocator_type &allocator)
 Allocator-extended move constructor.
virtual ~basic_sparse_set ()
 Default destructor.
basic_sparse_setoperator= (const basic_sparse_set &)=delete
 Default copy assignment operator, deleted on purpose.
basic_sparse_setoperator= (basic_sparse_set &&other) noexcept
 Move assignment operator.
void swap (basic_sparse_set &other) noexcept
 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 data on the free list whose meaning depends on the mode.
void free_list (const size_type value) noexcept
 Sets data on the free list whose meaning depends on the mode.
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.
const_iterator cbegin () const noexcept
 Returns an iterator to the beginning.
iterator end () const noexcept
 Returns an iterator to the end.
const_iterator cend () const noexcept
 Returns an iterator to the end.
reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the beginning.
const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the beginning.
reverse_iterator rend () const noexcept
 Returns a reverse iterator to the end.
const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the end.
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 operator[] (const size_type pos) const noexcept
 Returns the entity at specified location.
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.
template<typename It>
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.
template<typename It>
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.
template<typename It>
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.
template<typename Compare, typename Sort = std_sort, typename... Args>
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.
template<typename Compare, typename Sort = std_sort, typename... Args>
void sort (Compare compare, Sort algo=Sort{}, Args &&...args)
 Sort all elements according to the given comparison function.
template<typename It>
iterator sort_as (It first, It last)
 Sort entities according to their order in a range.
void clear ()
 Clears a sparse set.
const type_infoinfo () const noexcept
 Returns a type info object for the value type, if any.
const type_infotype () const noexcept
 Returns a type info object for the value type, if any.
template<typename Type>
void bind (Type &&value) noexcept
 Forwards variables to derived classes, if any.

Static Public Attributes

static constexpr deletion_policy storage_policy = deletion_policy::swap_only
 Storage deletion policy.

Protected Member Functions

void pop_all () override
 Erases all entities of a storage.
underlying_iterator try_emplace (const Entity hint, const bool, const void *) override
 Assigns an entity to a storage.
void pop (underlying_iterator first, underlying_iterator last) override
 Erases entities from 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 bind_any (any) noexcept
 Forwards variables to derived classes, if any.
Protected Member Functions inherited from entt::basic_sparse_set< Entity, Allocator >
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 bind_any (any) noexcept
 Forwards variables to derived classes, if any.

Additional Inherited Members

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

Detailed Description

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

Swap-only entity storage specialization.

Template Parameters
EntityA valid entity type.
AllocatorType of allocator used to manage memory and elements.

Definition at line 978 of file storage.hpp.

Member Typedef Documentation

◆ allocator_type

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

Allocator type.

Definition at line 1020 of file storage.hpp.

◆ base_type

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

Base type.

Definition at line 1022 of file storage.hpp.

◆ const_iterable

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

Constant extended iterable storage proxy.

Definition at line 1036 of file storage.hpp.

◆ const_iterator

using entt::basic_storage< Entity, Entity, Allocator, typename >::const_iterator

Constant random access iterator type.

Definition at line 418 of file storage.hpp.

◆ const_pointer

using entt::basic_storage< Entity, Entity, Allocator, typename >::const_pointer

Constant pointer type to contained elements.

Definition at line 414 of file storage.hpp.

◆ const_reverse_iterable

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

Constant extended reverse iterable storage proxy.

Definition at line 1040 of file storage.hpp.

◆ const_reverse_iterator

using entt::basic_storage< Entity, Entity, Allocator, typename >::const_reverse_iterator

Constant reverse iterator type.

Definition at line 422 of file storage.hpp.

◆ difference_type

template<typename Entity, typename Allocator>
using entt::basic_storage< Entity, Entity, Allocator >::difference_type = std::ptrdiff_t

Signed integer type.

Definition at line 1032 of file storage.hpp.

◆ element_type

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

Element type.

Definition at line 1024 of file storage.hpp.

◆ entity_type

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

Underlying entity identifier.

Definition at line 1028 of file storage.hpp.

◆ iterable

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

Extended iterable storage proxy.

Definition at line 1034 of file storage.hpp.

◆ iterator

using entt::basic_storage< Entity, Entity, Allocator, typename >::iterator

Random access iterator type.

Definition at line 416 of file storage.hpp.

◆ pointer

using entt::basic_storage< Entity, Entity, Allocator, typename >::pointer

Pointer type to contained elements.

Definition at line 412 of file storage.hpp.

◆ reverse_iterable

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

Extended reverse iterable storage proxy.

Definition at line 1038 of file storage.hpp.

◆ reverse_iterator

using entt::basic_storage< Entity, Entity, Allocator, typename >::reverse_iterator

Reverse iterator type.

Definition at line 420 of file storage.hpp.

◆ size_type

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

Unsigned integer type.

Definition at line 1030 of file storage.hpp.

◆ value_type

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

Type of the objects assigned to entities.

Definition at line 1026 of file storage.hpp.

Constructor & Destructor Documentation

◆ basic_storage() [1/4]

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

Default constructor.

Definition at line 1045 of file storage.hpp.

◆ basic_storage() [2/4]

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

Constructs an empty container with a given allocator.

Parameters
allocatorThe allocator to use.

Definition at line 1053 of file storage.hpp.

◆ basic_storage() [3/4]

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

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 1064 of file storage.hpp.

◆ basic_storage() [4/4]

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

Allocator-extended move constructor.

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

Definition at line 1074 of file storage.hpp.

Member Function Documentation

◆ begin()

const_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::begin ( ) const
inlinenodiscardnoexcept

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 565 of file storage.hpp.

◆ capacity()

size_type entt::basic_storage< Entity, Entity, Allocator, typename >::capacity ( ) const
inlinenodiscardoverridevirtualnoexcept

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 529 of file storage.hpp.

◆ cbegin()

const_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::cbegin ( ) const
inlinenodiscardnoexcept

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 559 of file storage.hpp.

◆ cend()

const_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::cend ( ) const
inlinenodiscardnoexcept

Returns an iterator to the end.

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

Definition at line 580 of file storage.hpp.

◆ crbegin()

const_reverse_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::crbegin ( ) const
inlinenodiscardnoexcept

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 601 of file storage.hpp.

◆ crend()

const_reverse_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::crend ( ) const
inlinenodiscardnoexcept

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 620 of file storage.hpp.

◆ each() [1/2]

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

Returns an iterable object to use to visit a storage.

The iterable object returns a tuple that contains the current entity.

Returns
An iterable object to use to visit the storage.

Definition at line 1201 of file storage.hpp.

◆ each() [2/2]

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

Returns an iterable object to use to visit a storage.

The iterable object returns a tuple that contains the current entity.

Returns
An iterable object to use to visit the storage.

Definition at line 1196 of file storage.hpp.

◆ emplace()

value_type & entt::basic_storage< Entity, 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 680 of file storage.hpp.

◆ end()

const_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::end ( ) const
inlinenodiscardnoexcept

Returns an iterator to the end.

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

Definition at line 585 of file storage.hpp.

◆ generate() [1/3]

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

Creates a new identifier or recycles a destroyed one.

Returns
A valid identifier.

Definition at line 1135 of file storage.hpp.

◆ generate() [2/3]

template<typename Entity, typename Allocator>
entity_type entt::basic_storage< Entity, Entity, Allocator >::generate ( const entity_type hint)
inline

Creates a new identifier or recycles a destroyed one.

If the requested identifier isn't in use, the suggested one is used. Otherwise, a new identifier is returned.

Parameters
hintRequired identifier.
Returns
A valid identifier.

Definition at line 1150 of file storage.hpp.

◆ generate() [3/3]

template<typename Entity, typename Allocator>
template<typename It>
void entt::basic_storage< Entity, Entity, Allocator >::generate ( It first,
It last )
inline

Assigns each element in a range an identifier.

Template Parameters
ItType of mutable forward iterator.
Parameters
firstAn iterator to the first element of the range to generate.
lastAn iterator past the last element of the range to generate.

Definition at line 1167 of file storage.hpp.

◆ get()

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

Returns the object assigned to an entity, that is void.

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

Definition at line 1117 of file storage.hpp.

◆ get_allocator()

allocator_type entt::basic_storage< Entity, Entity, Allocator, typename >::get_allocator ( ) const
inlinenodiscardconstexprnoexcept

Returns the associated allocator.

Returns
The associated allocator.

Definition at line 505 of file storage.hpp.

◆ get_as_tuple()

template<typename Entity, typename Allocator>
std::tuple entt::basic_storage< Entity, Entity, Allocator >::get_as_tuple ( const entity_type entt) const
inlinenodiscardnoexcept

Returns an empty tuple.

Parameters
enttA valid identifier.
Returns
Returns an empty tuple.

Definition at line 1126 of file storage.hpp.

◆ insert()

iterator entt::basic_storage< Entity, 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 first element inserted, if any.

Definition at line 720 of file storage.hpp.

◆ operator=() [1/2]

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

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This storage.

Definition at line 1092 of file storage.hpp.

◆ operator=() [2/2]

template<typename Entity, typename Allocator>
basic_storage & entt::basic_storage< Entity, Entity, Allocator >::operator= ( const basic_storage< Entity, Entity, Allocator > & )
delete

Default copy assignment operator, deleted on purpose.

Returns
This storage.

◆ patch()

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

Updates a given identifier.

Template Parameters
FuncTypes of the function objects to invoke.
Parameters
enttA valid identifier.
funcValid function objects.

Definition at line 1184 of file storage.hpp.

◆ pop()

void entt::basic_storage< Entity, 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 338 of file storage.hpp.

◆ pop_all()

template<typename Entity, typename Allocator>
void entt::basic_storage< Entity, Entity, Allocator >::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 1004 of file storage.hpp.

◆ raw()

const_pointer entt::basic_storage< Entity, Entity, Allocator, typename >::raw ( ) const
inlinenodiscardnoexcept

Direct access to the array of objects.

Returns
A pointer to the array of objects.

Definition at line 543 of file storage.hpp.

◆ rbegin()

const_reverse_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::rbegin ( ) const
inlinenodiscardnoexcept

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 606 of file storage.hpp.

◆ reach() [1/2]

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

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 1219 of file storage.hpp.

◆ reach() [2/2]

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

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 1214 of file storage.hpp.

◆ rend()

const_reverse_iterator entt::basic_storage< Entity, Entity, Allocator, typename >::rend ( ) const
inlinenodiscardnoexcept

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 625 of file storage.hpp.

◆ reserve()

void entt::basic_storage< Entity, 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 517 of file storage.hpp.

◆ shrink_to_fit()

void entt::basic_storage< Entity, 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 534 of file storage.hpp.

◆ start_from()

template<typename Entity, typename Allocator>
void entt::basic_storage< Entity, Entity, Allocator >::start_from ( const entity_type hint)
inline

Sets the starting identifier for generation.

The version is ignored, regardless of the value.

Parameters
hintA valid identifier.

Definition at line 1232 of file storage.hpp.

◆ swap()

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

Exchanges the contents with those of a given storage.

Parameters
otherStorage to exchange the content with.

Definition at line 1102 of file storage.hpp.

◆ try_emplace()

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

Assigns an entity to a storage.

Parameters
hintA valid identifier.
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 1014 of file storage.hpp.

Member Data Documentation

◆ storage_policy

template<typename Entity, typename Allocator>
deletion_policy entt::basic_storage< Entity, Entity, Allocator >::storage_policy = deletion_policy::swap_only
staticconstexpr

Storage deletion policy.

Definition at line 1042 of file storage.hpp.


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