Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Math::Vector< ValueT, N > Class Template Reference

#include <VectorMath.h>

Inheritance diagram for Harlinn::Math::Vector< ValueT, N >:
[legend]
Collaboration diagram for Harlinn::Math::Vector< ValueT, N >:
[legend]

Public Types

using Indices = std::make_index_sequence<N>
 
using ValueType = std::remove_cvref_t<ValueT>
 
using UIntType = MakeUnsigned<ValueType>
 
using Traits = SIMD::Traits<ValueType, N>
 

Public Member Functions

constexpr Vector () noexcept
 
template<typename T >
requires ( N > 1 )
constexpr Vector (T x) noexcept
 
template<typename... Args>
requires std::conjunction_v<std::is_same<ValueType, std::remove_cvref_t<Args>>...> && ( sizeof...( Args ) == N )
constexpr Vector (Args ...args)
 
constexpr size_t size () const noexcept
 
constexpr size_t capacity () const noexcept
 
constexpr ValueTypeoperator[] (size_t index) noexcept
 
constexpr const ValueTypeoperator[] (size_t index) const noexcept
 
constexpr Vector operator- () const
 
constexpr Vector operator+ (const Vector &other) const
 
constexpr Vector operator- (const Vector &other) const
 
constexpr Vector operator+ (const ValueType(&other)[N]) const
 
constexpr Vector operator- (const ValueType(&other)[N]) const
 
constexpr Vector operator+ (const ValueType value) const
 
constexpr Vector operator- (const ValueType value) const
 
constexpr Vector operator* (const ValueType value) const
 
constexpr Vector operator/ (const ValueType value) const
 
constexpr Vectoroperator+= (const Vector &other)
 
constexpr Vectoroperator-= (const Vector &other)
 
constexpr Vectoroperator+= (ValueType value)
 
constexpr Vectoroperator-= (ValueType value)
 
constexpr Vectoroperator*= (ValueType value)
 
constexpr Vectoroperator/= (ValueType value)
 
std::string ToString () const
 

Static Public Attributes

static constexpr size_t Size = N
 

Protected Types

using SIMDType = typename Traits::SIMDType
 

Protected Attributes

ValueType values_ [Capacity] = { }
 

Static Protected Attributes

static constexpr size_t Capacity = Traits::Capacity
 
static constexpr size_t SIMDIterations = Traits::SIMDIterations
 
static constexpr size_t SIMDValuesPerIteration = Traits::SIMDTypeSize / sizeof( ValueType )
 

Private Member Functions

template<size_t S, size_t... I>
constexpr Vector NegImpl (std::index_sequence< I... >) const
 
Vector NegImpl () const
 
template<size_t S, size_t... I>
constexpr Vector AddImpl (const ValueType(&other)[S], std::index_sequence< I... >) const
 
Vector AddImpl (const Vector &other) const
 
template<size_t... I>
constexpr Vector AddImpl (ValueType value, std::index_sequence< I... >) const
 
Vector AddImpl (ValueType value) const
 
template<size_t S, size_t... I>
constexpr Vector SubImpl (const ValueType(&other)[S], std::index_sequence< I... >) const
 
Vector SubImpl (const Vector &other) const
 
template<size_t... I>
constexpr Vector SubImpl (ValueType value, std::index_sequence< I... >) const
 
Vector SubImpl (ValueType value) const
 
template<size_t... I>
constexpr Vector MulImpl (ValueType value, std::index_sequence< I... >) const
 
Vector MulImpl (ValueType value) const
 
template<size_t... I>
constexpr Vector DivImpl (ValueType value, std::index_sequence< I... >) const
 
Vector DivImpl (ValueType value) const
 
template<size_t... I>
constexpr ValueType MagnitudeImpl (std::index_sequence< I... >) const
 
template<size_t... I>
constexpr bool EqualsImpl (const ValueType(&other)[N], std::index_sequence< I... >) const
 
constexpr bool EqualsImpl (const Vector &other) const
 
template<size_t S, size_t... I>
constexpr void AddAssignImpl (const ValueType(&other)[S], std::index_sequence< I... >)
 
constexpr void AddAssignImpl (const Vector &other)
 
template<size_t S, size_t... I>
constexpr void SubAssignImpl (const ValueType(&other)[N], std::index_sequence< I... >)
 
constexpr void SubAssignImpl (const Vector &other)
 
template<size_t... I>
constexpr void AddAssignImpl (ValueType value, std::index_sequence< I... >)
 
constexpr void AddAssignImpl (ValueType value)
 
template<size_t... I>
constexpr void SubAssignImpl (ValueType value, std::index_sequence< I... >)
 
constexpr void SubAssignImpl (ValueType value)
 
template<size_t... I>
constexpr void MulAssignImpl (ValueType value, std::index_sequence< I... >)
 
constexpr void MulAssignImpl (ValueType value)
 
template<size_t... I>
constexpr void DivAssignImpl (ValueType value, std::index_sequence< I... >)
 
constexpr void DivAssignImpl (ValueType value)
 

Detailed Description

template<ArithmeticType ValueT, size_t N>
class Harlinn::Math::Vector< ValueT, N >

Vector is specialized for:

The specializations are crafted for use in graphic apps.

Template Parameters
ValueT
Template Parameters
NThe size of the Vector

Member Typedef Documentation

◆ Indices

template<ArithmeticType ValueT, size_t N>
using Harlinn::Math::Vector< ValueT, N >::Indices = std::make_index_sequence<N>

◆ SIMDType

template<ArithmeticType ValueT, size_t N>
using Harlinn::Math::Vector< ValueT, N >::SIMDType = typename Traits::SIMDType
protected

◆ Traits

template<ArithmeticType ValueT, size_t N>
using Harlinn::Math::Vector< ValueT, N >::Traits = SIMD::Traits<ValueType, N>

◆ UIntType

template<ArithmeticType ValueT, size_t N>
using Harlinn::Math::Vector< ValueT, N >::UIntType = MakeUnsigned<ValueType>

◆ ValueType

template<ArithmeticType ValueT, size_t N>
using Harlinn::Math::Vector< ValueT, N >::ValueType = std::remove_cvref_t<ValueT>

Constructor & Destructor Documentation

◆ Vector() [1/3]

template<ArithmeticType ValueT, size_t N>
Harlinn::Math::Vector< ValueT, N >::Vector ( )
inlineconstexprnoexcept

◆ Vector() [2/3]

template<ArithmeticType ValueT, size_t N>
template<typename T >
requires ( N > 1 )
Harlinn::Math::Vector< ValueT, N >::Vector ( T x)
inlineconstexprnoexcept

◆ Vector() [3/3]

template<ArithmeticType ValueT, size_t N>
template<typename... Args>
requires std::conjunction_v<std::is_same<ValueType, std::remove_cvref_t<Args>>...> && ( sizeof...( Args ) == N )
Harlinn::Math::Vector< ValueT, N >::Vector ( Args ... args)
inlineconstexpr

Member Function Documentation

◆ AddAssignImpl() [1/4]

template<ArithmeticType ValueT, size_t N>
template<size_t S, size_t... I>
void Harlinn::Math::Vector< ValueT, N >::AddAssignImpl ( const ValueType(&) other[S],
std::index_sequence< I... >  )
inlineconstexprprivate

◆ AddAssignImpl() [2/4]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::AddAssignImpl ( const Vector< ValueT, N > & other)
inlineconstexprprivate

◆ AddAssignImpl() [3/4]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::AddAssignImpl ( ValueType value)
inlineconstexprprivate

◆ AddAssignImpl() [4/4]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
void Harlinn::Math::Vector< ValueT, N >::AddAssignImpl ( ValueType value,
std::index_sequence< I... >  )
inlineconstexprprivate

◆ AddImpl() [1/4]

template<ArithmeticType ValueT, size_t N>
template<size_t S, size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::AddImpl ( const ValueType(&) other[S],
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ AddImpl() [2/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::AddImpl ( const Vector< ValueT, N > & other) const
inlinenodiscardprivate

◆ AddImpl() [3/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::AddImpl ( ValueType value) const
inlinenodiscardprivate

◆ AddImpl() [4/4]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::AddImpl ( ValueType value,
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ capacity()

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::capacity ( ) const
inlineconstexprnoexcept

◆ DivAssignImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::DivAssignImpl ( ValueType value)
inlineconstexprprivate

◆ DivAssignImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
void Harlinn::Math::Vector< ValueT, N >::DivAssignImpl ( ValueType value,
std::index_sequence< I... >  )
inlineconstexprprivate

◆ DivImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::DivImpl ( ValueType value) const
inlinenodiscardprivate

◆ DivImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::DivImpl ( ValueType value,
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ EqualsImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
bool Harlinn::Math::Vector< ValueT, N >::EqualsImpl ( const ValueType(&) other[N],
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ EqualsImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
bool Harlinn::Math::Vector< ValueT, N >::EqualsImpl ( const Vector< ValueT, N > & other) const
inlinenodiscardconstexprprivate

◆ MagnitudeImpl()

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
ValueType Harlinn::Math::Vector< ValueT, N >::MagnitudeImpl ( std::index_sequence< I... > ) const
inlinenodiscardconstexprprivate

◆ MulAssignImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::MulAssignImpl ( ValueType value)
inlineconstexprprivate

◆ MulAssignImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
void Harlinn::Math::Vector< ValueT, N >::MulAssignImpl ( ValueType value,
std::index_sequence< I... >  )
inlineconstexprprivate

◆ MulImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::MulImpl ( ValueType value) const
inlinenodiscardprivate

◆ MulImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::MulImpl ( ValueType value,
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ NegImpl() [1/2]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::NegImpl ( ) const
inlinenodiscardprivate

◆ NegImpl() [2/2]

template<ArithmeticType ValueT, size_t N>
template<size_t S, size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::NegImpl ( std::index_sequence< I... > ) const
inlinenodiscardconstexprprivate

◆ operator*()

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator* ( const ValueType value) const
inlinenodiscardconstexpr

◆ operator*=()

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator*= ( ValueType value)
inlineconstexpr

◆ operator+() [1/3]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator+ ( const ValueType value) const
inlinenodiscardconstexpr

◆ operator+() [2/3]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator+ ( const ValueType(&) other[N]) const
inlinenodiscardconstexpr

◆ operator+() [3/3]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator+ ( const Vector< ValueT, N > & other) const
inlinenodiscardconstexpr

◆ operator+=() [1/2]

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator+= ( const Vector< ValueT, N > & other)
inlineconstexpr

◆ operator+=() [2/2]

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator+= ( ValueType value)
inlineconstexpr

◆ operator-() [1/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator- ( ) const
inlinenodiscardconstexpr

◆ operator-() [2/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator- ( const ValueType value) const
inlinenodiscardconstexpr

◆ operator-() [3/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator- ( const ValueType(&) other[N]) const
inlinenodiscardconstexpr

◆ operator-() [4/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator- ( const Vector< ValueT, N > & other) const
inlinenodiscardconstexpr

◆ operator-=() [1/2]

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator-= ( const Vector< ValueT, N > & other)
inlineconstexpr

◆ operator-=() [2/2]

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator-= ( ValueType value)
inlineconstexpr

◆ operator/()

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::operator/ ( const ValueType value) const
inlinenodiscardconstexpr

◆ operator/=()

template<ArithmeticType ValueT, size_t N>
Vector & Harlinn::Math::Vector< ValueT, N >::operator/= ( ValueType value)
inlineconstexpr

◆ operator[]() [1/2]

template<ArithmeticType ValueT, size_t N>
const ValueType & Harlinn::Math::Vector< ValueT, N >::operator[] ( size_t index) const
inlineconstexprnoexcept

◆ operator[]() [2/2]

template<ArithmeticType ValueT, size_t N>
ValueType & Harlinn::Math::Vector< ValueT, N >::operator[] ( size_t index)
inlineconstexprnoexcept

◆ size()

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::size ( ) const
inlineconstexprnoexcept

◆ SubAssignImpl() [1/4]

template<ArithmeticType ValueT, size_t N>
template<size_t S, size_t... I>
void Harlinn::Math::Vector< ValueT, N >::SubAssignImpl ( const ValueType(&) other[N],
std::index_sequence< I... >  )
inlineconstexprprivate

◆ SubAssignImpl() [2/4]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::SubAssignImpl ( const Vector< ValueT, N > & other)
inlineconstexprprivate

◆ SubAssignImpl() [3/4]

template<ArithmeticType ValueT, size_t N>
void Harlinn::Math::Vector< ValueT, N >::SubAssignImpl ( ValueType value)
inlineconstexprprivate

◆ SubAssignImpl() [4/4]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
void Harlinn::Math::Vector< ValueT, N >::SubAssignImpl ( ValueType value,
std::index_sequence< I... >  )
inlineconstexprprivate

◆ SubImpl() [1/4]

template<ArithmeticType ValueT, size_t N>
template<size_t S, size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::SubImpl ( const ValueType(&) other[S],
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ SubImpl() [2/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::SubImpl ( const Vector< ValueT, N > & other) const
inlinenodiscardprivate

◆ SubImpl() [3/4]

template<ArithmeticType ValueT, size_t N>
Vector Harlinn::Math::Vector< ValueT, N >::SubImpl ( ValueType value) const
inlinenodiscardprivate

◆ SubImpl() [4/4]

template<ArithmeticType ValueT, size_t N>
template<size_t... I>
Vector Harlinn::Math::Vector< ValueT, N >::SubImpl ( ValueType value,
std::index_sequence< I... >  ) const
inlinenodiscardconstexprprivate

◆ ToString()

template<ArithmeticType ValueT, size_t N>
std::string Harlinn::Math::Vector< ValueT, N >::ToString ( ) const
inlinenodiscard

Member Data Documentation

◆ Capacity

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::Capacity = Traits::Capacity
staticconstexprprotected

◆ SIMDIterations

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::SIMDIterations = Traits::SIMDIterations
staticconstexprprotected

◆ SIMDValuesPerIteration

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::SIMDValuesPerIteration = Traits::SIMDTypeSize / sizeof( ValueType )
staticconstexprprotected

◆ Size

template<ArithmeticType ValueT, size_t N>
size_t Harlinn::Math::Vector< ValueT, N >::Size = N
staticconstexpr

◆ values_

template<ArithmeticType ValueT, size_t N>
ValueType Harlinn::Math::Vector< ValueT, N >::values_[Capacity] = { }
protected

The documentation for this class was generated from the following file: