codex
|
Transparently stores T
objects as contiguous arrays of each field.
More...
#include <soa.hpp>
Public Types | |
template<std::size_t I> | |
using | field_type |
(Value/decayed) type of field with index I . | |
template<std::size_t I> | |
using | field_type |
(Value/decayed) type of field with index I . | |
Public Member Functions | |
std::size_t | size (void) const |
void | push_back (T &&t={}) |
T | operator[] (std::size_t i) const |
Indexed access to an element. | |
void | set (std::size_t i, const T &t) |
Stores the value of each field of t . | |
void | set (std::size_t i, T &&t) |
Stores the value of each field of t . | |
template<std::size_t I> | |
std::span< field_type< I > > | field (void) |
Provides access to the contiguous storage of field I . | |
template<std::size_t I> | |
std::span< const field_type< I > > | field (void) const |
std::size_t | size (void) const |
void | push_back (T &&t={}) |
T | operator[] (std::size_t i) const |
Indexed access to an element. | |
void | set (std::size_t i, const T &t) |
Stores the value of each field of t . | |
void | set (std::size_t i, T &&t) |
Stores the value of each field of t . | |
template<std::size_t I> | |
std::span< field_type< I > > | field (void) |
Provides access to the contiguous storage of field I . | |
template<std::size_t I> | |
std::span< const field_type< I > > | field (void) const |
template<std::size_t I> | |
auto | field (void) -> std::span< field_type< I > > |
template<std::size_t I> | |
auto | field (void) const -> std::span< const field_type< I > > |
Private Types | |
using | base_type = detail::storage<T, S> |
using | base_type = detail::storage<T, S> |
Transparently stores T
objects as contiguous arrays of each field.
The storage is a "transposition" of a T[]
: a structure of arrays instead of an array of structures. This allows each field array to be processed sequentially (e.g. in SIMD fashion).
An interface similar to std::vector
is also provided to add/set/remove elements of type T
as if that were the actual storage. Access methods are also provided, although they return values that are manufactured on demand, not references as is the case for std::vector
.
|
private |
|
private |
using codex::refl::SOA< T, S >::field_type |
(Value/decayed) type of field with index I
.
using codex::refl::SOA< T, S >::field_type |
(Value/decayed) type of field with index I
.
std::span< field_type< I > > codex::refl::SOA< T, S >::field | ( | void | ) |
Provides access to the contiguous storage of field I
.
std::span< field_type< I > > codex::refl::SOA< T, S >::field | ( | void | ) |
Provides access to the contiguous storage of field I
.
auto codex::refl::SOA< T, S >::field | ( | void | ) | -> std::span<field_type<I>> |
std::span< const field_type< I > > codex::refl::SOA< T, S >::field | ( | void | ) | const |
std::span< const field_type< I > > codex::refl::SOA< T, S >::field | ( | void | ) | const |
auto codex::refl::SOA< T, S >::field | ( | void | ) | const -> std::span<const field_type<I>> |
Indexed access to an element.
The returned value (n.b.: not a reference) is manufactured from the values of each field gathered from the storage.
T codex::refl::SOA< T, S >::operator[] | ( | std::size_t | i | ) | const |
Indexed access to an element.
The returned value (n.b.: not a reference) is manufactured from the values of each field gathered from the storage.
void codex::refl::SOA< T, S >::push_back | ( | T && | t = {} | ) |
void codex::refl::SOA< T, S >::set | ( | std::size_t | i, |
const T & | t ) |
Stores the value of each field of t
.
void codex::refl::SOA< T, S >::set | ( | std::size_t | i, |
const T & | t ) |
Stores the value of each field of t
.
Stores the value of each field of t
.
void codex::refl::SOA< T, S >::set | ( | std::size_t | i, |
T && | t ) |
Stores the value of each field of t
.
|
inline |
|
inline |