template <typename
Traits, typename
Allocator = soagen:: allocator>
table class
A table.
Effectively a multi-column std::
Public types
- using allocator_type = Allocator
- The allocator used by the table.
-
template <auto Column>using column_traits =
/* ... */ - Returns the soagen::
column_traits for the column at the specified index. -
template <auto Column>using column_type =
/* ... */ - Returns the
value_typefor the column at the specified index. -
using const_iterator = soagen::
const_iterator_type<table> - Row iterators returned by const-qualified iterator functions.
-
using const_row_type = soagen::
const_row_type<table> - Const row type used by tables.
-
using const_span_type = soagen::
const_span_type<table> - Const-qualified span type.
-
using difference_type = std::
ptrdiff_t - The signed integer difference type used by tables.
-
using iterator = soagen::
iterator_type<table> - Row iterators returned by iterator functions.
-
using row_type = soagen::
row_type<table> - Regular (lvalue-qualified) row type used by tables.
-
using rvalue_iterator = soagen::
rvalue_iterator_type<table> - Row iterators returned by rvalue-qualified iterator functions.
-
using rvalue_row_type = soagen::
rvalue_row_type<table> - Rvalue row type used by tables.
-
using rvalue_span_type = soagen::
rvalue_span_type<table> - Rvalue-qualified span type.
-
using size_type = std::
size_t - The unsigned integer size type used by tables.4.
-
using span_type = soagen::
span_type<table> - Regular (lvalue-qualified) span type.
- using table_traits = Traits
- The soagen::
table_traits for the table.
Public static variables
-
static constexpr
size_
t aligned_stride constexpr - The number of rows to advance to maintain the requested
alignmentfor every column. -
static constexpr
size_
type column_count constexpr - The number of columns in the table.
Constructors, destructors, conversion operators
Public functions
-
auto get_allocator() const → constexpr
allocator_
type constexpr noexcept - Returns the allocator being used by the table.
- auto operator=(table&&) → table& defaulted
- Move-assignment operator.
- auto operator=(const table&) → table& defaulted
- Copy-assignment operator.
-
auto table(const
allocator_
type& alloc) → constexpr explicit constexpr noexcept - Constructs with the given allocator.
-
auto table(allocator_
type&& alloc) → constexpr explicit constexpr noexcept - Constructs with the given allocator.
Adding rows
-
template <typename... Args>auto emplace(size_
type index, Args && ... args) → void noexcept(…) - Constructs a new row in-place at an arbitrary position in the table.
-
template <typename... Args>auto emplace_back(Args && ... args) → void noexcept(…)
- Constructs a new row in-place at the end of the table.
Capacity
-
auto allocation_size() const → constexpr
size_
t constexpr noexcept - Returns the size of the current underlying buffer allocation in bytes.
-
auto capacity() const → constexpr
size_
type constexpr noexcept - Returns the number of rows that can be held in currently allocated storage.
- auto empty() const → constexpr bool constexpr noexcept
- Returns true if the number of rows is zero.
-
auto max_size() const → constexpr
size_
type constexpr noexcept - Returns the maximum possible number of rows.
-
auto reserve(size_
type new_cap) → void noexcept(…) - Reserves storage for (at least) the given number of rows.
- auto shrink_to_fit() → void noexcept(…)
- Frees unused capacity.
-
auto size() const → constexpr
size_
type constexpr noexcept - Returns the current number of rows.
Columns
-
template <auto Column>auto column() → constexpr column_
type<Column>* constexpr noexcept - Returns a pointer to the elements of a specific column.
-
template <auto Column>auto column() const → constexpr std::
add_const_t<column_ type<Column>>* constexpr noexcept - Returns a const-qualified pointer to the elements of a specific column.
-
auto data() → constexpr
std::
byte* constexpr noexcept - Returns a pointer to the raw byte backing array.
-
auto data() const → constexpr
const
std::
byte* constexpr noexcept - Returns a const pointer to the raw byte backing array.
- auto for_each_column(Func&& func) → constexpr void constexpr noexcept(…)
- Invokes a function once for each column data pointer.
- auto for_each_column(Func&& func) const → constexpr void constexpr noexcept(…)
- Invokes a function once for each column data pointer (const overload).
Comparison
- auto operator<(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if the LHS table is ordered lexicographically less-than the RHS table.
- auto operator<=(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if the LHS table is ordered lexicographically less-than-or-equal-to the RHS table.
- auto operator>(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if the LHS table is ordered lexicographically greater-than the RHS table.
- auto operator>=(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if the LHS table is ordered lexicographically greater-than-or-equal-to the RHS table.
Equality
- auto operator!=(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if not all of the elements in two tables are equal.
- auto operator==(const table& lhs, const table& rhs) → constexpr bool constexpr noexcept(…)
- Returns true if all of the elements in two tables are equal.
Iterators
-
template <auto... Cols>auto begin() & → constexpr soagen::
iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to the first row in the table.
-
template <auto... Cols>auto begin() && → constexpr soagen::
rvalue_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to the first row in the table.
-
template <auto... Cols>auto begin() const & → constexpr soagen::
const_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to the first row in the table.
-
template <auto... Cols>auto cbegin() const → constexpr soagen::
const_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to the first row in the table.
-
template <auto... Cols>auto cend() const → constexpr soagen::
const_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to one-past-the-last row in the table.
-
template <auto... Cols>auto end() & → constexpr soagen::
iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to one-past-the-last row in the table.
-
template <auto... Cols>auto end() && → constexpr soagen::
rvalue_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to one-past-the-last row in the table.
-
template <auto... Cols>auto end() const & → constexpr soagen::
const_iterator_type<table, Cols...> constexpr noexcept - Returns an iterator to one-past-the-last row in the table.
Modifiers
- auto clear() → void noexcept
- Removes all rows from table.
-
auto erase(size_
type pos) → void noexcept(…) - Erases the row at the given index.
-
auto pop_back(size_
type num = 1) → void noexcept(…) - Removes the last row(s) from the table.
-
auto resize(size_
type new_size) → void noexcept(…) - Resizes the table to the given number of rows.
- auto swap(table& other) → constexpr void constexpr noexcept(…)
- Swaps the contents of the table with another.
- auto swap_columns() → void noexcept(…)
- Swaps two columns.
-
auto unordered_erase(size_
type pos) → soagen:: optional<size_ type> noexcept(…) - Erases the row at the given index without preserving order.
Rows
-
template <auto... Cols>auto at(size_
type index) & → soagen:: row_type<table, Cols...> - Returns the row at the given index.
-
template <auto... Cols>auto at(size_
type index) && → soagen:: rvalue_row_type<table, Cols...> - Returns the row at the given index (rvalue overload).
-
template <auto... Cols>auto at(size_
type index) const & → soagen:: const_row_type<table, Cols...> - Returns the row at the given index (const overload).
-
template <auto... Cols>auto back() & → soagen::
row_type<table, Cols...> noexcept - Returns the very last row in the table.
-
template <auto... Cols>auto back() && → soagen::
row_row_type<table, Cols...> noexcept - Returns the very last row in the table (rvalue overload).
-
template <auto... Cols>auto back() const & → soagen::
const_row_type<table, Cols...> noexcept - Returns the very last row in the table (const overload).
-
template <auto... Cols>auto front() & → soagen::
row_type<table, Cols...> noexcept - Returns the very first row in the table.
-
template <auto... Cols>auto front() && → soagen::
rvalue_row_type<table, Cols...> noexcept - Returns the very first row in the table (rvalue overload).
-
template <auto... Cols>auto front() const & → soagen::
const_row_type<table, Cols...> noexcept - Returns the very first row in the table (const overload).
-
auto operator[](size_
type index) & → row_ type noexcept - Returns the row at the given index.
-
auto operator[](size_
type index) && → rvalue_ row_ type noexcept - Returns the row at the given index (rvalue overload).
-
auto operator[](size_
type index) const & → const_ row_ type noexcept - Returns the row at the given index (const overload).
-
template <auto... Cols>auto row(size_
type index) & → soagen:: row_type<table, Cols...> noexcept - Returns the row at the given index.
-
template <auto... Cols>auto row(size_
type index) && → soagen:: rvalue_row_type<table, Cols...> noexcept - Returns the row at the given index.
-
template <auto... Cols>auto row(size_
type index) const & → soagen:: const_row_type<table, Cols...> noexcept - Returns the row at the given index.
Spans
-
auto const_subspan(size_
type start, size_ type count = static_ cast<size_ type>(-1)) const → const_ span_ type noexcept - Returns a const-qualified span of (some part of) the table.
-
auto subspan(size_
type start, size_ type count = static_ cast<size_ type>(-1)) & → span_ type noexcept - Returns a span of (some part of) the table.
-
auto subspan(size_
type start, size_ type count = static_ cast<size_ type>(-1)) && → rvalue_ span_ type noexcept - Returns an rvalue-qualified span of (some part of) the table.
-
auto subspan(size_
type start, size_ type count = static_ cast<size_ type>(-1)) const & → const_ span_ type noexcept - Returns a const-qualified span of (some part of) the table.
Function documentation
soagen:: optional<size_ type> soagen::table::unordered_erase(size_ type pos) noexcept(…)
Erases the row at the given index without preserving order.
| Returns | The index of the row that was moved into the erased row's position, if any. |
|---|
This is much faster than erase() because it uses the swap-and-pop idiom: Instead of shifting all the higher rows downward, the last row is moved into the position of the erased one and the size of the table is reduced by 1.
soagen:: row_type<table, Cols...> soagen::table::at(size_ type index) &
Returns the row at the given index.
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
| Exceptions | |
| std:: |
|
soagen:: rvalue_row_type<table, Cols...> soagen::table::at(size_ type index) &&
Returns the row at the given index (rvalue overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
| Exceptions | |
| std:: |
|
soagen:: const_row_type<table, Cols...> soagen::table::at(size_ type index) const &
Returns the row at the given index (const overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
| Exceptions | |
| std:: |
|
soagen:: row_row_type<table, Cols...> soagen::table::back() && noexcept
Returns the very last row in the table (rvalue overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: const_row_type<table, Cols...> soagen::table::back() const & noexcept
Returns the very last row in the table (const overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: rvalue_row_type<table, Cols...> soagen::table::front() && noexcept
Returns the very first row in the table (rvalue overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: const_row_type<table, Cols...> soagen::table::front() const & noexcept
Returns the very first row in the table (const overload).
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: row_type<table, Cols...> soagen::table::row(size_ type index) & noexcept
Returns the row at the given index.
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: rvalue_row_type<table, Cols...> soagen::table::row(size_ type index) && noexcept
Returns the row at the given index.
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
soagen:: const_row_type<table, Cols...> soagen::table::row(size_ type index) const & noexcept
Returns the row at the given index.
| Template parameters | |
|---|---|
| Cols | Indices of the columns to include in the row. Leave the list empty for all columns. |
Variable documentation
static constexpr
size_ t soagen::table::aligned_stride constexpr
The number of rows to advance to maintain the requested alignment for every column.
The stride size you need to use when iterating through rows of this table such that the starting element for each batch in each column would have the same memory alignment as the value specified for the column-specific alignment.