soagen namespace

The root namespace for the library.

Namespaces

namespace examples
Types generated by soagen for example purposes.

Classes

struct allocator
The default allocator used by soagen tables.
template <typename ValueType, size_t Align = alignof(ValueType), typename ParamType = soagen::param_type<ValueType>>
struct column_traits
Traits for a single column of a table.
template <typename... Args>
struct emplacer
Helper class for #table::emplace() and #table::emplace_back().
template <typename Soa, size_t... Columns>
class iterator
RandomAccessIterator for SoA types.
template <typename Derived>
struct iterator_base
Base class for soagen::iterator.
template <typename Soa, size_t... Columns>
struct row
A proxy type for treating (some subset of) an SoA row as if it were a regular AoS struct.
template <typename Derived>
struct row_base
Base class for soagen::row.
template <typename Soa>
class span
A span type for representing some subset of a SoA container's rows.
template <typename Derived>
struct span_base
Base class for soagen::span.
template <typename Traits, typename Allocator = soagen::allocator>
class table
A table.
template <typename Derived>
struct table_base
Base class for soagen::table.
template <typename... Columns>
struct table_traits
Traits for a table.

Typedefs

template <typename T>
using allocator_type = /* ... */
Gets the allocator being used by the soagen::table of an SoA type.
template <typename T>
using coerce_ref = std::conditional_t<std::is_reference_v<T>, T, std::add_lvalue_reference_t<T>>
Makes T into T& if T was not already a reference.
template <typename T, auto... Columns>
using column_indices = /* ... */
Gets the std::index_sequence type corresponding to the columns of a type, optionally overriding them.
template <typename T, bool Cond>
using conditionally_add_const = std::conditional_t<Cond, std::add_const_t<T>, T>
Conditionally adds const to a type.
template <typename T, bool Cond>
using conditionally_add_volatile = std::conditional_t<Cond, std::add_volatile_t<T>, T>
Conditionally adds volatile to a type.
template <typename T, bool Cond>
using conditionally_remove_cvref = std::conditional_t<Cond, remove_cvref<T>, T>
Conditionally removes all cvref-qualifiers from a type.
template <typename T, auto... Columns>
using const_iterator_type = /* ... */
The same as soagen::iterator_type but promoting the base SoA type to const (if it was not already).
template <typename T, auto... Columns>
using const_row_type = /* ... */
The same as soagen::row_type but promoting the base SoA type to const (if it was not already).
template <typename T>
using const_span_type = /* ... */
The same as soagen::span_type but promoting the base SoA type to const (if it was not already).
template <typename T, typename CopyFrom>
using copy_cv = /* ... */
Copies the cv-qualifiers from one type onto another, replacing the existing ones.
template <typename T, typename CopyFrom>
using copy_cvref = /* ... */
Copies the cvref-qualifiers from one type onto another, replacing the existing ones.
template <typename T, typename CopyFrom>
using copy_ref = /* ... */
Copies the ref-qualifiers from one type onto another, replacing the existing ones.
template <typename T>
using forward_type = /* ... */
The type that would result from std::forward<T>().
template <auto Value>
using index_constant = std::integral_constant<size_t, static_cast<size_t>(Value)>
Alias for std::integral_constant<std::size_t, Value>
template <typename T, auto... Columns>
using iterator_type = /* ... */
The soagen::iterator for a given type and (some subset of) its columns.
template <typename T>
using optional = std::optional<T>
The optional type used by the library.
template <typename ValueType>
using param_type = /* ... */
The default type soagen will use for a column in lvalue parameter contexts (e.g. push_back(const&)).
template <typename T>
using remove_cvref = std::remove_cv_t<std::remove_reference_t<T>>
Equivalent to C+20's std::remove_cvref_t.
template <typename T>
using remove_lvalue_ref = /* ... */
Removes lvalue reference qualifiers. Rvalues references are preserved as-is.
template <typename T, auto... Columns>
using row_type = /* ... */
The soagen::row for a given type and (some subset of) its columns.
template <typename T, auto... Columns>
using rvalue_iterator_type = /* ... */
The same as soagen::iterator_type but promoting the base SoA type to && (if it was not already).
template <typename T, auto... Columns>
using rvalue_row_type = /* ... */
The same as soagen::row_type but promoting the base SoA type to && (if it was not already).
template <typename T>
using rvalue_span_type = /* ... */
The same as soagen::span_type but promoting the base SoA type to && (if it was not already).
template <typename ParamType>
using rvalue_type = /* ... */
The type soagen will use for a column in rvalue parameter contexts (e.g. push_back(&&)).
template <typename T>
using soa_type = /* ... */
Gets the root SoA type from a type (e.g. T in soagen::row<T, Cols...>), without any cvref-qualifiers.
template <typename T>
using span_type = /* ... */
The soagen::span for a given type.
template <typename ValueType>
using storage_type = /* ... */
The internal storage type soagen will use to store a column.
template <typename T>
using table_traits_type = /* ... */
Gets the soagen::table_traits for the underlying soagen::table of a type.
template <typename T>
using table_type = /* ... */
Gets the underlying soagen::table of a type.
template <auto I, typename... T>
using type_at_index = /* ... */
Gets the type T at index I in the parameter pack.
template <typename T, auto Column>
using value_ref = /* ... */
Cvref-qualified version of soagen::value_type (i.e. having cvref-qualifiers derived from T).
template <typename T, auto Column>
using value_type = /* ... */
Gets the soagen::column_traits::value_type for the selected column of a type.

Functions

template <typename T, typename Func>
void for_each_column(T&& obj, Func&& func) noexcept(…)
Invokes a callable once for each column in an object.
template <size_t I, typename T>
auto get_from_tuple(T&& tuple) →  decltype(auto) constexpr noexcept
Gets the member at index I from tuple-like T.
template <typename T>
auto get_source_offset(] const T& object) →  std::size_t constexpr noexcept
Gets the base index offset from an object.
template <typename... Args>
void swap(table<Args...>& lhs, table<Args...>& rhs) constexpr noexcept(…)
Swaps the contents of two tables.

Variables

template <typename T, auto Column>
size_t actual_alignment constexpr
Determines the actual minimum alignment for a table column.
template <typename... T>
bool all_integer constexpr
True if all T are (non-bool) integers.
template <typename T, typename... U>
bool any_same constexpr
True if any U are the same as T.
template <auto Value, auto... Values>
bool any_same_value constexpr
True if Value is in the list Values.
template <typename... T>
bool has_data_member constexpr
True if all T have a data() member.
template <typename T, typename... Args>
bool has_emplace_back_member constexpr
True if T has an emplace_back(Args...) member.
template <typename T, typename Pos, typename... Args>
bool has_emplace_member constexpr
True if T has an emplace(Pos, Args...) member.
template <typename... T>
bool has_erase_member constexpr
True if all T have an erase(size_t) member.
template <typename... T>
bool has_nothrow_data_member constexpr
True if all T have a non-throwing data() member.
template <typename T, typename... Args>
bool has_nothrow_emplace_back_member constexpr
True if T has a non-throwing emplace_back(Args...) member.
template <typename T, typename Pos, typename... Args>
bool has_nothrow_emplace_member constexpr
True if T has a non-throwing emplace(Pos, Args...) member.
template <typename... T>
bool has_nothrow_erase_member constexpr
True if all T have a non-throwing erase(size_t) member.
template <typename... T>
bool has_nothrow_resize_member constexpr
True if all T have a non-throwing resize(size_t) member.
template <typename... T>
bool has_nothrow_swap_member constexpr
True if all T have a non-throwing swap(T&) member.
template <typename... T>
bool has_nothrow_unordered_erase_member constexpr
True if all T have a non-throwing unordered_erase(size_t) member.
template <typename... T>
bool has_resize_member constexpr
True if all T have a resize(size_t) member.
template <typename T>
bool has_source_offset constexpr
True if T has a source_offset() member function, or one found via ADL.
template <typename... T>
bool has_swap_member constexpr
True if all T have a swap(T&) member.
template <typename... T>
bool has_unordered_erase_member constexpr
True if all T have an unordered_erase(size_t) member.
template <typename T>
bool is_column_traits constexpr
True if T is a soagen::column_traits.
template <typename T, typename Tuple>
bool is_constructible_by_unpacking_tuple constexpr
True if T is constructible from the tuple-like Tuple by unpacking its members.
template <typename T>
bool is_cv constexpr
True if T is const or volatile qualified.
template <typename T>
bool is_cvref constexpr
True if T is (or is a reference to something that is) const or volatile qualified.
template <template<typename...> typename Trait, typename... Args>
auto is_detected constexpr
Detects if Trait can be applied to a set of Args.
template <typename T>
bool is_emplacer constexpr
True if T is an instance of soagen::emplacer.
template <typename T, typename U = T>
bool is_equality_comparable constexpr
True if T and U meet the EqualityComparable named requirement.
template <typename T>
bool is_implicit_lifetime_type constexpr
True if T meets the ImplicitLifetimeType named requirement.
template <typename T>
bool is_integer constexpr
True if T is a (non-bool) integer.
template <typename Func, typename... Args>
bool is_invocable constexpr
True if Func is invocable with Args.
template <size_t I, typename Func, typename Arg>
bool is_invocable_with_optional_index constexpr
True if Func is invocable with Arg and an optional index_constant/size_t.
template <typename T>
bool is_iterator constexpr
True if T is a soagen::iterator.
template <typename T, typename U = T>
bool is_less_than_comparable constexpr
True if T and U meet the LessThanComparable named requirement.
template <typename T, typename U = T>
bool is_nothrow_equality_comparable constexpr
True if T and U meet the EqualityComparable named requirement without throwing.
template <typename Func, typename... Args>
bool is_nothrow_invocable constexpr
True if Func is nothrow-invocable with Args.
template <size_t I, typename Func, typename Arg>
bool is_nothrow_invocable_with_optional_index constexpr
True if Func is nothrow-invocable with Arg and an optional index_constant/size_t.
template <typename T, typename U = T>
bool is_nothrow_less_than_comparable constexpr
True if T and U meet the LessThanComparable named requirement without throwing.
template <typename T>
bool is_row constexpr
True if T is a soagen::row.
template <typename T>
bool is_soa constexpr
True if T is a soagen::table or a soagen-generated SoA class.
template <typename T>
bool is_span constexpr
True if T is a soagen::span.
template <typename T>
bool is_table constexpr
True if T is a soagen::table.
template <typename T>
bool is_table_traits constexpr
True if T is a soagen::table_traits.
template <typename T>
bool is_tuple constexpr
True if T implements the tuple protocol.
template <typename T>
bool is_unsigned constexpr
True if T is a (non-bool) unsigned integer.
template <typename A, typename B>
bool same_table_type constexpr
True if two types have the same underlying soagen::table type.

Typedef documentation

template <typename T>
using soagen::allocator_type = /* ... */

Gets the allocator being used by the soagen::table of an SoA type.

Template parameters
T A table, allocator, row, span, iterator, or some soagen-generated SoA class.

template <typename T, auto... Columns>
using soagen::column_indices = /* ... */

Gets the std::index_sequence type corresponding to the columns of a type, optionally overriding them.

Template parameters
T A table, table_traits, row, span, iterator, or some soagen-generated SoA class.
Columns

template <typename T, auto... Columns>
using soagen::iterator_type = /* ... */

The soagen::iterator for a given type and (some subset of) its columns.

Template parameters
T A table, row, span, iterator, or some soagen-generated SoA class.
Columns The columns viewed by the iterator. Leave empty to copy the columns from the source.

template <typename T>
using soagen::optional = std::optional<T>

The optional type used by the library.

template <typename ValueType>
using soagen::param_type = /* ... */

The default type soagen will use for a column in lvalue parameter contexts (e.g. push_back(const&)).

Types chosen by this trait aim to be a good default:

Move-only typesT&&
Small, trivially-copyable typesT
Everything elseconst T&

template <typename T, auto... Columns>
using soagen::row_type = /* ... */

The soagen::row for a given type and (some subset of) its columns.

Template parameters
T A table, row, span, iterator, or some soagen-generated SoA class.
Columns The columns viewed by the row. Leave empty to copy the columns from the source.

template <typename T>
using soagen::span_type = /* ... */

The soagen::span for a given type.

Template parameters
T A table, row, span, iterator, or some soagen-generated SoA class.

template <typename ValueType>
using soagen::storage_type = /* ... */

The internal storage type soagen will use to store a column.

In most cases it will be the same as the ValueType, but in some circumstances soagen is able to reduce the number of template instantiations (and thus binary size) by applying simple and safe type transformations (e.g. removing const and volatile, storing all pointer types as void*, et cetera.)

template <typename T>
using soagen::table_traits_type = /* ... */

Gets the soagen::table_traits for the underlying soagen::table of a type.

Template parameters
T A table, table_traits, row, span, iterator, or some soagen-generated SoA class.

template <typename T>
using soagen::table_type = /* ... */

Gets the underlying soagen::table of a type.

Template parameters
T A table, row, span, iterator, or some soagen-generated SoA class.

Function documentation

template <typename T, typename Func>
void soagen::for_each_column(T&& obj, Func&& func) noexcept(…)

Invokes a callable once for each column in an object.

Template parameters
T A class type with a column<N>() template member function (e.g. tables, spans, rows).
Func

A callable type compatible with one of the following signatures:

Overload resolution is performed in the order listed above.

Parameters
obj The object to invoke the callable on for each column.
func The callable to invoke.

template <typename... Args>
void soagen::swap(table<Args...>& lhs, table<Args...>& rhs) constexpr noexcept(…)

Swaps the contents of two tables.

Variable documentation

template <typename T, auto Column>
size_t soagen::actual_alignment constexpr

Determines the actual minimum alignment for a table column.

This value is based on a number of factors: