EnTT: entt::basic_table< Container > Class Template Reference

EnTT 3.15.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 | difference_type = std::ptrdiff_t
| Signed 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_table & | operator= (const basic_table &)=delete
| Default copy assignment operator, deleted on purpose.
basic_table & | operator= (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

  Container | Sequence 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 160 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 164 of file table.hpp.

## ◆ difference_type

template<typename... Container>

using entt::basic_table< Container >::difference_type = std::ptrdiff_t

Signed integer type.

Definition at line 156 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 158 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 162 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 167 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

  container | The containers to copy from.

Definition at line 175 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

  container | The containers to move from.

Definition at line 184 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

  other | The instance to move from.

Definition at line 196 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

  Allocator | Type of allocator.

Parameters

  allocator | A valid allocator.

Definition at line 205 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

  Allocator | Type of allocator.

Parameters

  container | The containers to copy from.
  allocator | A valid allocator.

Definition at line 215 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

  Allocator | Type of allocator.

Parameters

  container | The containers to move from.
  allocator | A valid allocator.

Definition at line 227 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

  Allocator | Type of allocator.

Parameters

  other | The instance to move from.
  allocator | The allocator to use.

Definition at line 239 of file table.hpp.

## Member Function Documentation

## ◆ begin() [1/2]

template<typename... Container>

const_iterator entt::basic_table< Container >::begin | ( |  | ) | const
| inlinenodiscardnoexcept

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

## ◆ begin() [2/2]

template<typename... Container>

iterator entt::basic_table< Container >::begin | ( |  | ) |
| inlinenodiscardnoexcept

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

## ◆ capacity()

template<typename... Container>

size_type entt::basic_table< Container >::capacity | ( |  | ) | const
| inlinenodiscardnoexcept

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

Returns
  Capacity of the table.

Definition at line 287 of file table.hpp.

## ◆ cbegin()

template<typename... Container>

const_iterator entt::basic_table< Container >::cbegin | ( |  | ) | const
| inlinenodiscardnoexcept

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

## ◆ cend()

template<typename... Container>

const_iterator entt::basic_table< Container >::cend | ( |  | ) | const
| inlinenodiscardnoexcept

Returns an iterator to the end.

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

Definition at line 337 of file table.hpp.

## ◆ clear()

template<typename... Container>

void entt::basic_table< Container >::clear | ( |  | ) |
| inline

Clears a table.

Definition at line 442 of file table.hpp.

## ◆ crbegin()

template<typename... Container>

const_reverse_iterator entt::basic_table< Container >::crbegin | ( |  | ) | const
| inlinenodiscardnoexcept

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

## ◆ crend()

template<typename... Container>

const_reverse_iterator entt::basic_table< Container >::crend | ( |  | ) | const
| inlinenodiscardnoexcept

Returns a reverse iterator to the end.

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

Definition at line 377 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

  Args | Types of arguments to use to construct the row data.

Parameters

  args | Parameters to use to construct the row data.

Returns
  A reference to the newly created row data.

Definition at line 398 of file table.hpp.

## ◆ empty()

template<typename... Container>

bool entt::basic_table< Container >::empty | ( |  | ) | const
| inlinenodiscardnoexcept

Checks whether a table is empty.

Returns
  True if the table is empty, false otherwise.

Definition at line 308 of file table.hpp.

## ◆ end() [1/2]

template<typename... Container>

const_iterator entt::basic_table< Container >::end | ( |  | ) | const
| inlinenodiscardnoexcept

Returns an iterator to the end.

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

Definition at line 342 of file table.hpp.

## ◆ end() [2/2]

template<typename... Container>

iterator entt::basic_table< Container >::end | ( |  | ) |
| inlinenodiscardnoexcept

Returns an iterator to the end.

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

Definition at line 347 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

  pos | Index of the row to remove.

Definition at line 420 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

  pos | An iterator to the row to remove.

Returns
  An iterator following the removed row.

Definition at line 411 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

  other | The instance to move from.

Returns
  This container.

Definition at line 256 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 | ) |
| inlinenodiscard

Returns the row data at specified location.

Parameters

  pos | The row for which to return the data.

Returns
  The row data at specified location.

Definition at line 436 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
| inlinenodiscard

Returns the row data at specified location.

Parameters

  pos | The row for which to return the data.

Returns
  The row data at specified location.

Definition at line 430 of file table.hpp.

## ◆ rbegin() [1/2]

template<typename... Container>

const_reverse_iterator entt::basic_table< Container >::rbegin | ( |  | ) | const
| inlinenodiscardnoexcept

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

## ◆ rbegin() [2/2]

template<typename... Container>

reverse_iterator entt::basic_table< Container >::rbegin | ( |  | ) |
| inlinenodiscardnoexcept

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

## ◆ rend() [1/2]

template<typename... Container>

const_reverse_iterator entt::basic_table< Container >::rend | ( |  | ) | const
| inlinenodiscardnoexcept

Returns a reverse iterator to the end.

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

Definition at line 382 of file table.hpp.

## ◆ rend() [2/2]

template<typename... Container>

reverse_iterator entt::basic_table< Container >::rend | ( |  | ) |
| inlinenodiscardnoexcept

Returns a reverse iterator to the end.

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

Definition at line 387 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

  cap | Desired capacity.

Definition at line 278 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 292 of file table.hpp.

## ◆ size()

template<typename... Container>

size_type entt::basic_table< Container >::size | ( |  | ) | const
| inlinenodiscardnoexcept

Returns the number of rows in a table.

Returns
  Number of rows.

Definition at line 300 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

  other | Table to exchange the content with.

Definition at line 265 of file table.hpp.

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

- src/entt/container/fwd.hpp
- src/entt/container/table.hpp