1#ifndef CODEX_REFLECTION_SOA_HPP
2#define CODEX_REFLECTION_SOA_HPP
22template<
typename T,
typename S = detail::storage_descriptor>
28 template<std::
size_t I>
30 std::decay_t<std::tuple_element_t<I, field_tuple_t<T>>>;
42 void set(std::size_t i,
const T &
t);
44 void set(std::size_t i,
T &&
t);
46 template<std::
size_t I> std::span<field_type<I>>
field(
void);
47 template<std::
size_t I> std::span<const field_type<I>>
field(
void)
const;
50template<
typename T,
typename S>
53 this->for_each_i(i, [
t =
field_tuple(ret)](
auto fi,
auto &
x) {
54 std::get<fi()>(
t) =
x;
59template<
typename T,
typename S>
62 this->for_each([&
t]<
typename F, std::size_t I>(field_storage<S, I, F> &v) {
67template<
typename T,
typename S>
69 this->for_each_i(i, [&
t](
auto vi,
auto &
x) {
74template<
typename T,
typename S>
76 this->for_each_i(i, [&
t](
auto vi,
auto &
x) {
81template<
typename T,
typename S>
82template<std::
size_t I>
88template<
typename T,
typename S>
89template<std::
size_t I>
Transparently stores T objects as contiguous arrays of each field.
Definition soa.hpp:23
T operator[](std::size_t i) const
Indexed access to an element.
Definition soa.hpp:51
std::decay_t< std::tuple_element_t< I, field_tuple_t< T > > > field_type
(Value/decayed) type of field with index I.
Definition soa.hpp:29
std::size_t size(void) const
Definition soa.hpp:32
std::span< const field_type< I > > field(void) const
void push_back(T &&t={})
Definition soa.hpp:60
void set(std::size_t i, const T &t)
Stores the value of each field of t.
Definition soa.hpp:68
std::span< field_type< I > > field(void)
Provides access to the contiguous storage of field I.
Ultimate class for the storage of each field.
Definition soa.hpp:21
#define x
Definition gcc14.c:1
storage_impl< S, std::make_index_sequence< refl::field_count< T >()>, refl::field_tuple_t< T > > storage
Storage for all fields of a structure.
Definition soa.hpp:102
auto field_tuple(T &&t)
Constructs a tuple of references to each field of T, in order.
Definition fields.hpp:35
codex::refl::field_tuple_t< E > T
Definition soa.cpp:9
#define CODEX_FWD(x)
Definition utils.hpp:8
#define t(a)
Definition std2.c:10