mal-math
C++20 mathematics library.
|
Definition of the mathematical vector with fixed size L
and type T
More...
#include "vecn.hpp"
Public Types | |
using | type = T |
Type of the vector elements. | |
Public Member Functions | |
constexpr | vec ()=default |
Default constructor. | |
template<Primitive U> | |
constexpr | vec (U value) |
Constructor initializing all elements to the given value. | |
template<typename... U> | |
constexpr | vec (U... data) |
Variadic constructor. | |
constexpr | vec (std::array< T, size > const &arr) |
Constructor from std::array. | |
constexpr | vec (std::array< T, size > &&arr) |
Move constructor from std::array. | |
constexpr void | reset () noexcept |
Resets the vector to the zero vector. | |
template<typename U > | |
constexpr vec< size, T > & | operator= (vec< size, U > const &b) |
Overloaded assignment operator. | |
template<Primitive U> | |
constexpr vec< L, T > & | operator+= (U const value) noexcept |
template<Primitive U> | |
constexpr vec< L, T > & | operator-= (U const value) noexcept |
template<Primitive U> | |
constexpr vec< L, T > & | operator*= (U const value) noexcept |
template<Primitive U> | |
constexpr vec< L, T > & | operator/= (U const value) noexcept |
template<Primitive U> | |
constexpr vec< L, T > & | operator%= (U const value) noexcept |
template<AnyVec U> requires (size == U::size) | |
constexpr vec< L, T > & | operator+= (U const &other) noexcept |
template<AnyVec U> requires (size == U::size) | |
constexpr vec< L, T > & | operator-= (U const &other) noexcept |
template<AnyVec U> requires (size == U::size) | |
constexpr vec< L, T > & | operator*= (U const &other) noexcept |
template<AnyVec U> requires (size == U::size) | |
constexpr vec< L, T > & | operator/= (U const &other) noexcept |
template<AnyVec U> requires (size == U::size) | |
constexpr vec< L, T > & | operator%= (U const &other) noexcept |
constexpr T & | operator[] (size_t i) |
Overloaded subscript operator for non-const rvec. | |
constexpr T const & | operator[] (size_t i) const |
Overloaded subscript operator for const rvec. | |
Public Attributes | |
std::array< T, size > | data |
The underlying data of the vector. | |
Static Public Attributes | |
static constexpr size_t | size = L |
Number of elements in the vector. | |
Private Member Functions | |
template<Primitive U> | |
constexpr void | unpack_data (size_t offset, U u) |
Unpacks a single primitive value into the vector data. | |
template<class V > | |
constexpr void | unpack_data (size_t offset, V vec) |
Unpacks a vector into the matrix data. | |
template<typename A , typename B , typename... C> | |
constexpr void | unpack_data (size_t offset, A a, B b, C... c) |
Recursively unpacks multiple values into the vector data. | |
Static Private Member Functions | |
template<Primitive _> | |
static constexpr size_t | get_parameter_pack_size () |
Determines the size of a parameter pack for primitive types. | |
template<class V > | |
static constexpr size_t | get_parameter_pack_size () |
Determines the size of a parameter pack for vector types. | |
template<typename A , typename B , typename... C> | |
static constexpr size_t | get_parameter_pack_size () |
Determines the size of a parameter pack for a mixed set of types. | |
Definition of the mathematical vector with fixed size L
and type T
Represents a generic vector of a given primitive type.
L | Length of the vector. |
T | The primitive type of the vector. |
using mal_math::vec< L, T >::type = T |
|
constexprdefault |
Default constructor.
|
explicitconstexpr |
|
explicitconstexpr |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
staticconstexprprivate |
|
staticconstexprprivate |
Determines the size of a parameter pack for vector types.
|
staticconstexprprivate |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
inlineconstexpr |
|
nodiscardconstexpr |
|
nodiscardconstexpr |
|
constexprnoexcept |
|
inlineconstexprprivate |
Recursively unpacks multiple values into the vector data.
offset | The position to start unpacking in the vector data. |
first | The first value to unpack. |
second | The second value to unpack. |
rest | The remaining values to unpack. |
Definition at line 161 of file vecn.hpp.
|
inlineconstexprprivate |
|
inlineconstexprprivate |
std::array<T, size> mal_math::vec< L, T >::data |
|
staticconstexpr |