EnTT  3.10.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
entt::basic_storage< Entity, Type, Allocator, typename > Class Template Reference

Basic storage implementation. More...

#include <storage.hpp>

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

Public Types

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

Protected Member Functions

void swap_and_pop (typename underlying_type::basic_iterator first, typename underlying_type::basic_iterator last) override
 Erases elements from a storage. More...
 
void in_place_pop (typename underlying_type::basic_iterator first, typename underlying_type::basic_iterator last) override
 Erases elements from a storage. More...
 
underlying_type::basic_iterator try_emplace ([[maybe_unused]] const Entity entt, const bool force_back, const void *value) override
 Assigns an entity to a storage. More...
 
- Protected Member Functions inherited from entt::basic_sparse_set< Entity, std::allocator_traits< Allocator >::template rebind_alloc< Entity > >
virtual basic_iterator try_emplace (const Entity entt, const bool force_back, const void *=nullptr)
 Assigns an entity to a sparse set. More...
 

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 Entity, typename Type, typename Allocator, typename>
class entt::basic_storage< Entity, Type, 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
EntityA valid entity type (see entt_traits for more details).
TypeType of objects assigned to the entities.
AllocatorType of allocator used to manage memory and elements.

Definition at line 234 of file storage.hpp.

Constructor & Destructor Documentation

◆ basic_storage() [1/3]

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

◆ basic_storage() [2/3]

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

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 423 of file storage.hpp.

◆ basic_storage() [3/3]

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

Allocator-extended move constructor.

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

Definition at line 432 of file storage.hpp.

Member Function Documentation

◆ begin() [1/2]

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

Returns an iterator to the beginning.

The returned iterator points to the first instance of the internal array. 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 539 of file storage.hpp.

◆ begin() [2/2]

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

Returns an iterator to the beginning.

The returned iterator points to the first instance of the internal array. 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 534 of file storage.hpp.

◆ capacity()

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

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

◆ cbegin()

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

Returns an iterator to the beginning.

The returned iterator points to the first instance of the internal array. 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 528 of file storage.hpp.

◆ cend()

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

Returns an iterator to the end.

The returned iterator points to the element following the last instance of the internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 554 of file storage.hpp.

◆ crbegin()

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

Returns a reverse iterator to the beginning.

The returned iterator points to the first instance of the reversed internal array. 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 577 of file storage.hpp.

◆ crend()

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

Returns a reverse iterator to the end.

The returned iterator points to the element following the last instance of the reversed internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 601 of file storage.hpp.

◆ each() [1/2]

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

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

◆ each() [2/2]

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

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

◆ emplace()

template<typename Entity , typename Type , typename Allocator , typename >
template<typename... Args>
value_type& entt::basic_storage< Entity, Type, 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 661 of file storage.hpp.

◆ end() [1/2]

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

Returns an iterator to the end.

The returned iterator points to the element following the last instance of the internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 564 of file storage.hpp.

◆ end() [2/2]

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

Returns an iterator to the end.

The returned iterator points to the element following the last instance of the internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 559 of file storage.hpp.

◆ get() [1/2]

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

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

◆ get() [2/2]

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

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

◆ get_allocator()

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

Returns the associated allocator.

Returns
The associated allocator.

Definition at line 473 of file storage.hpp.

◆ get_as_tuple() [1/2]

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

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

◆ get_as_tuple() [2/2]

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

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

◆ in_place_pop()

template<typename Entity , typename Type , typename Allocator , typename >
void entt::basic_storage< Entity, Type, Allocator, typename >::in_place_pop ( typename underlying_type::basic_iterator  first,
typename underlying_type::basic_iterator  last 
)
inlineoverrideprotectedvirtual

Erases elements from a storage.

Parameters
firstAn iterator to the first element to erase.
lastAn iterator past the last element to erase.

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

Definition at line 349 of file storage.hpp.

◆ insert() [1/2]

template<typename Entity , typename Type , 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>>>
void entt::basic_storage< Entity, Type, 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.

Definition at line 719 of file storage.hpp.

◆ insert() [2/2]

template<typename Entity , typename Type , typename Allocator , typename >
template<typename It >
void entt::basic_storage< Entity, Type, 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.

Definition at line 700 of file storage.hpp.

◆ operator=()

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

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This storage.

Definition at line 448 of file storage.hpp.

◆ patch()

template<typename Entity , typename Type , typename Allocator , typename >
template<typename... Func>
value_type& entt::basic_storage< Entity, Type, 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 679 of file storage.hpp.

◆ raw() [1/2]

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

Direct access to the array of objects.

Returns
A pointer to the array of objects.

Definition at line 516 of file storage.hpp.

◆ raw() [2/2]

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

Direct access to the array of objects.

Returns
A pointer to the array of objects.

Definition at line 511 of file storage.hpp.

◆ rbegin() [1/2]

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

Returns a reverse iterator to the beginning.

The returned iterator points to the first instance of the reversed internal array. 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 587 of file storage.hpp.

◆ rbegin() [2/2]

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

Returns a reverse iterator to the beginning.

The returned iterator points to the first instance of the reversed internal array. 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 582 of file storage.hpp.

◆ rend() [1/2]

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

Returns a reverse iterator to the end.

The returned iterator points to the element following the last instance of the reversed internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 611 of file storage.hpp.

◆ rend() [2/2]

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

Returns a reverse iterator to the end.

The returned iterator points to the element following the last instance of the reversed internal array. Attempting to dereference the returned iterator results in undefined behavior.

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

Definition at line 606 of file storage.hpp.

◆ reserve()

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

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.

Definition at line 485 of file storage.hpp.

◆ swap()

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

Exchanges the contents with those of a given storage.

Parameters
otherStorage to exchange the content with.

Definition at line 462 of file storage.hpp.

◆ swap_and_pop()

template<typename Entity , typename Type , typename Allocator , typename >
void entt::basic_storage< Entity, Type, Allocator, typename >::swap_and_pop ( typename underlying_type::basic_iterator  first,
typename underlying_type::basic_iterator  last 
)
inlineoverrideprotectedvirtual

Erases elements from a storage.

Parameters
firstAn iterator to the first element to erase.
lastAn iterator past the last element to erase.

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

Definition at line 334 of file storage.hpp.

◆ try_emplace()

template<typename Entity , typename Type , typename Allocator , typename >
underlying_type::basic_iterator entt::basic_storage< Entity, Type, Allocator, typename >::try_emplace ( [[maybe_unused] ] const Entity  entt,
const bool  force_back,
const void *  value 
)
inlineoverrideprotected

Assigns an entity to a storage.

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

Definition at line 363 of file storage.hpp.


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