template <typename Soa, size_t... Columns>
row struct
A proxy type for treating (some subset of) an SoA row as if it were a regular AoS struct.
This type has reference semantics; In addition to the member functions described below, rows for soagen
-generated SoA types will named member references variables matching their columns, e.g.:
[structs.employees] variables = [ {name = "id", type = "unsigned long long"}, {name = "name", type = "std::string"}, {name = "salary", type = "long long"}, ]
Would correspond to:
struct soagen::row<employees> { unsigned long long& id; std::string& name; long long& salary; };
Alternatively, if you're not using the generator and are just using a soagen::
// a row for this type: using employees = soagen::table<unsigned long long, std::string, long long /* ... */>; * * // would look like this: * struct soagen::row<employees> * { * unsigned long long& first; * std::string& second; * long long& third; * * // ...and so on, up to "sixteenth". * }; *
Columns
-
template <auto Column>auto column() const → decltype(auto) constexpr noexcept
- Returns a reference to the specified column's value.
-
template <typename Func>void for_each_column(Func&& func) const constexpr noexcept(…)
- Invokes a callable once for each column in the row.
Comparison
-
template <typename T>auto operator<(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if the RHS row is ordered lexicographically less-than the RHS row.
-
template <typename T>auto operator<=(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if the RHS row is ordered lexicographically less-than-or-equal-to the RHS row.
-
template <typename T>auto operator>(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if the RHS row is ordered lexicographically greater-than the RHS row.
-
template <typename T>auto operator>=(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if the RHS row is ordered lexicographically greater-than-or-equal-to the RHS row.
Conversion
-
template <typename T, size_t... Cols>operator row<T, Cols...>() const constexpr noexcept
- Converts between different rows for the same SoA type.
Equality
-
template <typename T>auto operator!=(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if not all of the elements in two rows are equal.
-
template <typename T>auto operator==(const row& lhs, const row<T, Columns...>& rhs) → bool constexpr noexcept(…)
- Returns true if all of the elements in two rows are equal.
Tuple protocol
-
template <auto Member>auto get() const → decltype(auto) constexpr noexcept
- Returns a reference to the specified member's value.
Function documentation
void soagen::row::for_each_column(Func&& func) const constexpr noexcept(…)
Invokes a callable once for each column in the row.
soagen::row::operator row<T, Cols...>() const constexpr noexcept
Converts between different rows 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() |