template <typename Soa>
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() constexpr noexcept
- Default constructor.
- span(const span&) defaulted
- Copy constructor.
-
span(soa_
ref soa, size_ type start, size_ type count = static_cast<size_ type>(-1)) constexpr noexcept - Constructs a span for some part of a SoA container.
-
span(soa_
ref soa) explicit constexpr noexcept - Constructs a span for an entire SoA container.
Public functions
Columns
-
template <auto Column>auto column() const → auto* constexpr noexcept
- Returns a pointer to the elements of a specific column.
-
template <typename Func>void for_each_column(Func&& func) const constexpr noexcept(…)
- Invokes a function once for each column data pointer (const overload).
Conversion
-
template <typename T>operator span<T>() const constexpr noexcept
- Converts between different spans for the same SoA type.
Iterators
-
template <auto... Cols>auto begin() const → soagen::
iterator_type<Soa, Cols...> constexpr noexcept - Returns an iterator to the first row viewed by the span.
-
template <auto... Cols>auto cbegin() const → 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 → 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 → 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
Source SoA containers
- auto source() const → Soa* constexpr noexcept
- The source container for this span.
-
auto source_offset() const → 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>
template <typename Func>
void soagen::span::for_each_column(Func&& func) const constexpr noexcept(…)
template <typename Func>
Invokes a function once for each column data pointer (const overload).
Template parameters | |
---|---|
Func | A callable type compatible with one of the following signatures:
Overload resolution is performed in the order listed above. |
Parameters | |
func | The callable to invoke. |
template <typename Soa>
template <typename T>
soagen::span::operator span<T>() const constexpr noexcept
template <typename T>
Converts between different spans for the same SoA type.
This operator allows the following conversions, only some of which are implicit:
From | To | explicit | Note |
---|---|---|---|
T& | const T& | gains const | |
T&& | T& | && →
& | |
T&& | const T& | && →
& , gains const | |
T&& | const T&& | gains const | |
const T&& | const T& | && →
& | |
T& | T&& | Yes | Equivalent to std::move() |
T& | const T&& | Yes | Equivalent to std::move() |
const T& | const T&& | Yes | Equivalent to std::move() |
template <typename Soa>
template <auto... Cols>
soagen:: row_type<Soa, Cols...> soagen::span::at(size_ type index) const
template <auto... Cols>
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:: |
template <typename Soa>
template <auto... Cols>
soagen:: row_type<Soa, Cols...> soagen::span::back() const noexcept
template <auto... Cols>
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>
template <auto... Cols>
soagen:: row_type<Soa, Cols...> soagen::span::front() const noexcept
template <auto... Cols>
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>
template <auto... Cols>
soagen:: row_type<Soa, Cols...> soagen::span::row(size_ type index) const noexcept
template <auto... Cols>
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>
Soa* soagen::span::source() const constexpr noexcept
The source container for this span.