cubos::core::reflection::VectorTrait class

Trait for types which represent math vectors using fixed-size contiguous arrays of scalars.

Assumes the vector is represented as a contiguous array of scalars, with the first element at offset 0, the second at offset scalarType.size(), and so on. The scalar size must be a multiple of its alignment.

Constructors, destructors, conversion operators

VectorTrait(const Type& scalarType, std::size_t dimensions)
Constructs.

Public functions

auto scalarType() const -> const Type&
Returns the type of the scalar elements of the vector.
auto dimensions() const -> std::size_t
Returns the number of dimensions of the vector.
auto get(void* value, std::size_t index) const -> void*
Accesses the scalar element at the given index.
auto get(const void* value, std::size_t index) const -> const void*
Accesses the scalar element at the given index.

Function documentation

cubos::core::reflection::VectorTrait::VectorTrait(const Type& scalarType, std::size_t dimensions)

Constructs.

Parameters
scalarType Type of the scalar elements of the vector.
dimensions Number of dimensions.

const Type& cubos::core::reflection::VectorTrait::scalarType() const

Returns the type of the scalar elements of the vector.

Returns Type of the scalar elements of the vector.

std::size_t cubos::core::reflection::VectorTrait::dimensions() const

Returns the number of dimensions of the vector.

Returns Number of dimensions of the vector.

void* cubos::core::reflection::VectorTrait::get(void* value, std::size_t index) const

Accesses the scalar element at the given index.

Parameters
value Pointer to the vector instance.
index Index of the scalar element to access.
Returns Pointer to the scalar element at the given index.

const void* cubos::core::reflection::VectorTrait::get(const void* value, std::size_t index) const

Accesses the scalar element at the given index.

Parameters
value Pointer to the vector instance.
index Index of the scalar element to access.
Returns Pointer to the scalar element at the given index.