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
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
Conversion
- 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
Source SoA containers
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
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:
| 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() |
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:: |
|
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. |
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. |