template <typename Soa>
soagen::span class

A span type for representing some subset of a SoA container's rows.

Public types

using const_iterator = soagen::const_iterator_type<Soa>
Row iterators returned by "c"-prefixed iterator functions.
using const_span_type = soagen::const_span_type<Soa>
Const-qualified span type.
using difference_type = std::ptrdiff_t
Signed integer difference type used by the corresponding SoA type.
using iterator = soagen::iterator_type<Soa>
Row iterators returned by iterator functions.
using row_type = soagen::row_type<Soa>
soagen::row type used by this span.
using size_type = std::size_t
Unsigned integer size type used by the corresponding SoA type.
using soa_ref = coerce_ref<Soa>
Cvref-qualified version of soa_type.
using soa_type = remove_cvref<Soa>
Base SoA type for this span.
using span_type = span
Alias for this span.

Constructors, destructors, conversion operators

span(const span&) defaulted
Copy constructor.

Public functions

auto operator=(const span&) →  span& defaulted
Copy-assignment operator.
auto span() →  constexpr constexpr noexcept
Default constructor.
auto span(soa_ref soa, size_type start, size_type count = static_cast<size_type>(-1)) →  constexpr constexpr noexcept
Constructs a span for some part of a SoA container.
auto span(soa_ref soa) →  constexpr explicit constexpr noexcept
Constructs a span for an entire SoA container.

Columns

template <auto Column>
auto column() const →  constexpr auto* constexpr noexcept
Returns a pointer to the elements of a specific column.
template <typename Func>
auto for_each_column(Func&& func) const →  constexpr void constexpr noexcept(…)
Invokes a function once for each column data pointer (const overload).

Conversion

template <typename T>
auto operator span<T>() const →  constexpr constexpr noexcept
Converts between different spans for the same SoA type.

Iterators

template <auto... Cols>
auto begin() const →  constexpr soagen::iterator_type<Soa, Cols...> constexpr noexcept
Returns an iterator to the first row viewed by the span.
template <auto... Cols>
auto cbegin() const →  constexpr soagen::const_iterator_type<Soa, Cols...> constexpr noexcept
Returns a const iterator to the first row viewed by the span.
template <auto... Cols>
auto cend() const →  constexpr soagen::const_iterator_type<Soa, Cols...> constexpr noexcept
Returns a const iterator to one-past-the-last row viewed by the span.
template <auto... Cols>
auto end() const →  constexpr soagen::iterator_type<Soa, Cols...> constexpr noexcept
Returns an iterator to one-past-the-last row viewed by the span.

Rows

template <auto... Cols>
auto at(size_type index) const →  soagen::row_type<Soa, Cols...>
Returns the row at the given index.
template <auto... Cols>
auto back() const →  soagen::row_type<Soa, Cols...> noexcept
Returns the last row viewed by the span.
template <auto... Cols>
auto front() const →  soagen::row_type<Soa, Cols...> noexcept
Returns the first row viewed by the span.
auto operator[](size_type index) const →  row_type noexcept
Returns the row at the given index.
template <auto... Cols>
auto row(size_type index) const →  soagen::row_type<Soa, Cols...> noexcept
Returns the row at the given index.

Size

auto empty() const →  constexpr bool constexpr noexcept
Returns true if the number of rows viewed by the span is zero.
auto size() const →  constexpr size_type constexpr noexcept
Returns the number of rows viewed by the span.

Source SoA containers

auto source() const →  constexpr Soa* constexpr noexcept
The source container for this span.
auto source_offset() const →  constexpr size_type constexpr noexcept
The base index offset of this span as it relates to the source container.

Spans

auto const_subspan(size_type start, size_type count = static_cast<size_type>(-1)) const →  const_span_type noexcept
Returns a const-qualified subspan of this span.
auto subspan(size_type start, size_type count = static_cast<size_type>(-1)) const →  span_type noexcept
Returns a subspan of this span.

Function documentation

template <typename Soa _1>
template <typename Func>
constexpr void soagen::span::for_each_column(Func&& func) const constexpr noexcept(…)

Invokes a function once for each column data pointer (const overload).

Parameters
func The callable to invoke.

template <typename Soa _1>
template <typename T>
constexpr soagen::span::operator span<T>() const constexpr noexcept

Converts between different spans for the same SoA type.

This operator allows the following conversions, only some of which are implicit:

FromToexplicitNote
T&const T&gains const
T&&T&&&&
T&&const T&&&&, gains const
T&&const T&&gains const
const T&&const T&&&&
T&T&&YesEquivalent to std::move()
T&const T&&YesEquivalent to std::move()
const T&const T&&YesEquivalent to std::move()

template <typename Soa _1>
template <auto... Cols>
soagen::row_type<Soa, Cols...> soagen::span::at(size_type index) const

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::out_of_range

template <typename Soa _1>
template <auto... Cols>
soagen::row_type<Soa, Cols...> soagen::span::back() const noexcept

Returns the last row viewed by the span.

Template parameters
Cols Indices of the columns to include in the row. Leave the list empty for all columns.

template <typename Soa _1>
template <auto... Cols>
soagen::row_type<Soa, Cols...> soagen::span::front() const noexcept

Returns the first row viewed by the span.

Template parameters
Cols Indices of the columns to include in the row. Leave the list empty for all columns.

template <typename Soa _1>
template <auto... Cols>
soagen::row_type<Soa, Cols...> soagen::span::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.

template <typename Soa _1>
constexpr Soa* soagen::span::source() const constexpr noexcept

The source container for this span.