EnTT 3.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_table< Container > Class Template Reference

Basic table implementation. More...

#include <table.hpp>

Public Types

using size_type = std::size_t
 Unsigned integer type.
 
using iterator = internal::table_iterator<typename Container::iterator...>
 Input iterator type.
 
using const_iterator = internal::table_iterator<typename Container::const_iterator...>
 Constant input iterator type.
 
using reverse_iterator = internal::table_iterator<typename Container::reverse_iterator...>
 Reverse iterator type.
 
using const_reverse_iterator = internal::table_iterator<typename Container::const_reverse_iterator...>
 Constant reverse iterator type.
 

Public Member Functions

 basic_table ()
 Default constructor.
 
 basic_table (const Container &...container) noexcept
 Copy constructs the underlying containers.
 
 basic_table (Container &&...container) noexcept
 Move constructs the underlying containers.
 
 basic_table (const basic_table &)=delete
 Default copy constructor, deleted on purpose.
 
 basic_table (basic_table &&other) noexcept
 Move constructor.
 
template<typename Allocator >
 basic_table (const Allocator &allocator)
 Constructs the underlying containers using a given allocator.
 
template<class Allocator >
 basic_table (const Container &...container, const Allocator &allocator) noexcept
 Copy constructs the underlying containers using a given allocator.
 
template<class Allocator >
 basic_table (Container &&...container, const Allocator &allocator) noexcept
 Move constructs the underlying containers using a given allocator.
 
template<class Allocator >
 basic_table (basic_table &&other, const Allocator &allocator)
 Allocator-extended move constructor.
 
 ~basic_table ()=default
 Default destructor.
 
basic_tableoperator= (const basic_table &)=delete
 Default copy assignment operator, deleted on purpose.
 
basic_tableoperator= (basic_table &&other) noexcept
 Move assignment operator.
 
void swap (basic_table &other) noexcept
 Exchanges the contents with those of a given table.
 
void reserve (const size_type cap)
 Increases the capacity of a table.
 
size_type capacity () const noexcept
 Returns the number of rows that a table has currently allocated space for.
 
void shrink_to_fit ()
 Requests the removal of unused capacity.
 
size_type size () const noexcept
 Returns the number of rows in a table.
 
bool empty () const noexcept
 Checks whether a table is empty.
 
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.
 
template<typename... Args>
std::tuple< typename Container::value_type &... > emplace (Args &&...args)
 Appends a row to the end of a table.
 
iterator erase (const_iterator pos)
 Removes a row from a table.
 
void erase (const size_type pos)
 Removes a row from a table.
 
std::tuple< const typename Container::value_type &... > operator[] (const size_type pos) const
 Returns the row data at specified location.
 
std::tuple< typename Container::value_type &... > operator[] (const size_type pos)
 Returns the row data at specified location.
 
void clear ()
 Clears a table.
 

Detailed Description

template<typename... Container>
class entt::basic_table< Container >

Basic table implementation.

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

Template Parameters
ContainerSequence container row types.

Definition at line 149 of file table.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename... Container>
using entt::basic_table< Container >::const_iterator = internal::table_iterator<typename Container::const_iterator...>

Constant input iterator type.

Definition at line 158 of file table.hpp.

◆ const_reverse_iterator

template<typename... Container>
using entt::basic_table< Container >::const_reverse_iterator = internal::table_iterator<typename Container::const_reverse_iterator...>

Constant reverse iterator type.

Definition at line 162 of file table.hpp.

◆ iterator

template<typename... Container>
using entt::basic_table< Container >::iterator = internal::table_iterator<typename Container::iterator...>

Input iterator type.

Definition at line 156 of file table.hpp.

◆ reverse_iterator

template<typename... Container>
using entt::basic_table< Container >::reverse_iterator = internal::table_iterator<typename Container::reverse_iterator...>

Reverse iterator type.

Definition at line 160 of file table.hpp.

◆ size_type

template<typename... Container>
using entt::basic_table< Container >::size_type = std::size_t

Unsigned integer type.

Definition at line 154 of file table.hpp.

Constructor & Destructor Documentation

◆ basic_table() [1/8]

template<typename... Container>
entt::basic_table< Container >::basic_table ( )
inline

Default constructor.

Definition at line 165 of file table.hpp.

◆ basic_table() [2/8]

template<typename... Container>
entt::basic_table< Container >::basic_table ( const Container &... container)
inlineexplicitnoexcept

Copy constructs the underlying containers.

Parameters
containerThe containers to copy from.

Definition at line 173 of file table.hpp.

◆ basic_table() [3/8]

template<typename... Container>
entt::basic_table< Container >::basic_table ( Container &&... container)
inlineexplicitnoexcept

Move constructs the underlying containers.

Parameters
containerThe containers to move from.

Definition at line 182 of file table.hpp.

◆ basic_table() [4/8]

template<typename... Container>
entt::basic_table< Container >::basic_table ( basic_table< Container > && other)
inlinenoexcept

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 194 of file table.hpp.

◆ basic_table() [5/8]

template<typename... Container>
template<typename Allocator >
entt::basic_table< Container >::basic_table ( const Allocator & allocator)
inlineexplicit

Constructs the underlying containers using a given allocator.

Template Parameters
AllocatorType of allocator.
Parameters
allocatorA valid allocator.

Definition at line 203 of file table.hpp.

◆ basic_table() [6/8]

template<typename... Container>
template<class Allocator >
entt::basic_table< Container >::basic_table ( const Container &... container,
const Allocator & allocator )
inlinenoexcept

Copy constructs the underlying containers using a given allocator.

Template Parameters
AllocatorType of allocator.
Parameters
containerThe containers to copy from.
allocatorA valid allocator.

Definition at line 213 of file table.hpp.

◆ basic_table() [7/8]

template<typename... Container>
template<class Allocator >
entt::basic_table< Container >::basic_table ( Container &&... container,
const Allocator & allocator )
inlinenoexcept

Move constructs the underlying containers using a given allocator.

Template Parameters
AllocatorType of allocator.
Parameters
containerThe containers to move from.
allocatorA valid allocator.

Definition at line 225 of file table.hpp.

◆ basic_table() [8/8]

template<typename... Container>
template<class Allocator >
entt::basic_table< Container >::basic_table ( basic_table< Container > && other,
const Allocator & allocator )
inline

Allocator-extended move constructor.

Template Parameters
AllocatorType of allocator.
Parameters
otherThe instance to move from.
allocatorThe allocator to use.

Definition at line 237 of file table.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename... Container>
const_iterator entt::basic_table< Container >::begin ( ) const
inlinenoexcept

Returns an iterator to the beginning.

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

Returns
An iterator to the first row of the table.

Definition at line 322 of file table.hpp.

◆ begin() [2/2]

template<typename... Container>
iterator entt::basic_table< Container >::begin ( )
inlinenoexcept

Returns an iterator to the beginning.

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

Returns
An iterator to the first row of the table.

Definition at line 327 of file table.hpp.

◆ capacity()

template<typename... Container>
size_type entt::basic_table< Container >::capacity ( ) const
inlinenoexcept

Returns the number of rows that a table has currently allocated space for.

Returns
Capacity of the table.

Definition at line 285 of file table.hpp.

◆ cbegin()

template<typename... Container>
const_iterator entt::basic_table< Container >::cbegin ( ) const
inlinenoexcept

Returns an iterator to the beginning.

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

Returns
An iterator to the first row of the table.

Definition at line 317 of file table.hpp.

◆ cend()

template<typename... Container>
const_iterator entt::basic_table< Container >::cend ( ) const
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last row of the table.

Definition at line 335 of file table.hpp.

◆ clear()

template<typename... Container>
void entt::basic_table< Container >::clear ( )
inline

Clears a table.

Definition at line 440 of file table.hpp.

◆ crbegin()

template<typename... Container>
const_reverse_iterator entt::basic_table< Container >::crbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the beginning.

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

Returns
An iterator to the first row of the reversed table.

Definition at line 356 of file table.hpp.

◆ crend()

template<typename... Container>
const_reverse_iterator entt::basic_table< Container >::crend ( ) const
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last row of the reversed table.

Definition at line 375 of file table.hpp.

◆ emplace()

template<typename... Container>
template<typename... Args>
std::tuple< typename Container::value_type &... > entt::basic_table< Container >::emplace ( Args &&... args)
inline

Appends a row to the end of a table.

Template Parameters
ArgsTypes of arguments to use to construct the row data.
Parameters
argsParameters to use to construct the row data.
Returns
A reference to the newly created row data.

Definition at line 396 of file table.hpp.

◆ empty()

template<typename... Container>
bool entt::basic_table< Container >::empty ( ) const
inlinenoexcept

Checks whether a table is empty.

Returns
True if the table is empty, false otherwise.

Definition at line 306 of file table.hpp.

◆ end() [1/2]

template<typename... Container>
const_iterator entt::basic_table< Container >::end ( ) const
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last row of the table.

Definition at line 340 of file table.hpp.

◆ end() [2/2]

template<typename... Container>
iterator entt::basic_table< Container >::end ( )
inlinenoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last row of the table.

Definition at line 345 of file table.hpp.

◆ erase() [1/2]

template<typename... Container>
void entt::basic_table< Container >::erase ( const size_type pos)
inline

Removes a row from a table.

Parameters
posIndex of the row to remove.

Definition at line 418 of file table.hpp.

◆ erase() [2/2]

template<typename... Container>
iterator entt::basic_table< Container >::erase ( const_iterator pos)
inline

Removes a row from a table.

Parameters
posAn iterator to the row to remove.
Returns
An iterator following the removed row.

Definition at line 409 of file table.hpp.

◆ operator=() [1/2]

template<typename... Container>
basic_table & entt::basic_table< Container >::operator= ( basic_table< Container > && other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This container.

Definition at line 254 of file table.hpp.

◆ operator=() [2/2]

template<typename... Container>
basic_table & entt::basic_table< Container >::operator= ( const basic_table< Container > & )
delete

Default copy assignment operator, deleted on purpose.

Returns
This container.

◆ operator[]() [1/2]

template<typename... Container>
std::tuple< typename Container::value_type &... > entt::basic_table< Container >::operator[] ( const size_type pos)
inline

Returns the row data at specified location.

Parameters
posThe row for which to return the data.
Returns
The row data at specified location.

Definition at line 434 of file table.hpp.

◆ operator[]() [2/2]

template<typename... Container>
std::tuple< const typename Container::value_type &... > entt::basic_table< Container >::operator[] ( const size_type pos) const
inline

Returns the row data at specified location.

Parameters
posThe row for which to return the data.
Returns
The row data at specified location.

Definition at line 428 of file table.hpp.

◆ rbegin() [1/2]

template<typename... Container>
const_reverse_iterator entt::basic_table< Container >::rbegin ( ) const
inlinenoexcept

Returns a reverse iterator to the beginning.

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

Returns
An iterator to the first row of the reversed table.

Definition at line 361 of file table.hpp.

◆ rbegin() [2/2]

template<typename... Container>
reverse_iterator entt::basic_table< Container >::rbegin ( )
inlinenoexcept

Returns a reverse iterator to the beginning.

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

Returns
An iterator to the first row of the reversed table.

Definition at line 366 of file table.hpp.

◆ rend() [1/2]

template<typename... Container>
const_reverse_iterator entt::basic_table< Container >::rend ( ) const
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last row of the reversed table.

Definition at line 380 of file table.hpp.

◆ rend() [2/2]

template<typename... Container>
reverse_iterator entt::basic_table< Container >::rend ( )
inlinenoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last row of the reversed table.

Definition at line 385 of file table.hpp.

◆ reserve()

template<typename... Container>
void entt::basic_table< Container >::reserve ( const size_type cap)
inline

Increases the capacity of a table.

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 276 of file table.hpp.

◆ shrink_to_fit()

template<typename... Container>
void entt::basic_table< Container >::shrink_to_fit ( )
inline

Requests the removal of unused capacity.

Definition at line 290 of file table.hpp.

◆ size()

template<typename... Container>
size_type entt::basic_table< Container >::size ( ) const
inlinenoexcept

Returns the number of rows in a table.

Returns
Number of rows.

Definition at line 298 of file table.hpp.

◆ swap()

template<typename... Container>
void entt::basic_table< Container >::swap ( basic_table< Container > & other)
inlinenoexcept

Exchanges the contents with those of a given table.

Parameters
otherTable to exchange the content with.

Definition at line 263 of file table.hpp.


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