Simple-Vector v1.3.0
sl::vec Namespace Reference

Namespaces

namespace  detail
 
namespace  fn
 
namespace  gen
 

Classes

struct  is_vectorial
 Checks whether T is a vector type. More...
 
struct  is_vectorial< Vector< T, VDimensions > >
 Specialization for Vector which registers Vector with all its template variations as vectorial. More...
 
class  Vector
 A mathematically vector implementation. More...
 
struct  vector_traits
 Uniform interface to Vector types. More...
 
struct  vector_traits< Vector< T, VDimensions > >
 Specialization for Vector. More...
 

Concepts

concept  add_assignable
 Checks if the given type can be used in mutable plus operations.
 
concept  sub_assignable
 Checks if the given type can be used in mutable minus operations.
 
concept  mul_assignable
 Checks if the given type can be used in mutable multiplication operations.
 
concept  div_assignable
 Checks if the given type can be used in mutable division operations.
 
concept  mod_assignable
 Checks if the given type can be used in mutable modulo operations.
 
concept  addable
 Checks if the given type can be used in immutable plus operations.
 
concept  subable
 Checks if the given type can be used in immutable minus operations.
 
concept  mulable
 Checks if the given type can be used in immutable multiplication operations.
 
concept  divable
 Checks if the given type can be used in immutable division operations.
 
concept  modable
 Checks if the given type can be used in immutable module operations.
 
concept  binary_invokable_with_all_overloads_implicit_convertible_to
 Checks if binary operation has all four overloads (one for each parameter constellation) and if all of those overloads are implicitly convertible to the result type.
 
concept  value_type
 Checks if the given type is regular and can be used in common arithmetically operations.
 
concept  vectorial
 Concept checking for vectorial types.
 

Typedefs

template<class T >
using vector_value_t = typename vector_traits< std::remove_cvref_t< T > >::value_type
 Convenience alias type to the value_type of Vectors. More...
 

Functions

template<std::ranges::input_range TRange, std::weakly_incrementable TOut, std::copy_constructible TUnaryOp>
constexpr void transform_unseq (TRange &&range, TOut result, TUnaryOp unaryOp)
 Applies the given unary operation to each element and writes into result. More...
 
template<std::ranges::input_range TRange1, std::ranges::input_range TRange2, std::weakly_incrementable TOut, std::copy_constructible TBinaryOp>
constexpr void transform_unseq (TRange1 &&range1, TRange2 &&range2, TOut result, TBinaryOp binaryOp)
 Applies the given unary operation to each element and writes into result. More...
 
template<std::ranges::input_range TRange, std::move_constructible T, std::copy_constructible TBinaryOp, std::copy_constructible TUnaryOp>
constexpr T transform_reduce_unseq (TRange &&range, T init, TBinaryOp binaryOp, TUnaryOp unaryOp)
 Applies the unaryOp to each elements from the range and reduces the results (possibly permuted and aggregated unspecified manner) along with the initial value init over binaryOp. More...
 
template<std::ranges::input_range TRange1, std::ranges::input_range TRange2, std::move_constructible T, std::copy_constructible TBinaryOp1, std::copy_constructible TBinaryOp2>
constexpr T transform_reduce_unseq (TRange1 &&range1, TRange2 &&range2, T init, TBinaryOp1 binaryOp1, TBinaryOp2 binaryOp2)
 Applies the binaryOp2 to each pair of elements from both ranges and reduces the results (possibly permuted and aggregated unspecified manner) along with the initial value init over binaryOp1. More...
 
template<class... T>
 Vector (T &&...) -> Vector< std::common_type_t< T... >, sizeof...(T)>
 Vector deduction guide to make aggregate-like construction easier. More...
 
template<vectorial TVector, add_assignable< TVector > T2>
constexpr TVector operator+ (TVector lhs, T2 &&rhs)
 Sum operator. More...
 
template<vectorial TVector, sub_assignable< TVector > T2>
constexpr TVector operator- (TVector lhs, T2 &&rhs)
 Minus operator. More...
 
template<vectorial TVector, mul_assignable< TVector > T2>
constexpr TVector operator* (TVector lhs, T2 &&rhs)
 Multiplication operator. More...
 
template<vectorial TVector, mul_assignable< TVector > T2>
constexpr TVector operator* (T2 &&lhs, TVector rhs)
 Commutative multiplication operator. More...
 
template<vectorial TVector, div_assignable< TVector > T2>
constexpr TVector operator/ (TVector lhs, T2 &&rhs)
 Division operator. More...
 
template<vectorial TVector, mod_assignable< TVector > T2>
constexpr TVector operator% (TVector lhs, T2 &&rhs)
 Modulo operator. More...
 
template<vectorial TVector1, vectorial TVector2>
requires mulable<vector_value_t<TVector2>, vector_value_t<TVector1>>
constexpr vector_value_t< TVector1 > dot_product (const TVector1 &lhs, const TVector2 &rhs)
 Calculates the dot product of to Vectors. More...
 
template<vectorial TVector>
constexpr vector_value_t< TVector > length_squared (const TVector &vector)
 Calculates the squared length of a Vector. More...
 
template<vectorial TVector>
constexpr auto length (const TVector &vector)
 Calculates the length of a Vector. More...
 
template<vectorial TVector>
requires std::floating_point<vector_value_t<TVector>>
constexpr TVector normalized (TVector vec)
 Calculates the normalization of a Vector. More...
 
template<vectorial TVector>
constexpr TVector projected (const TVector &vector, TVector target)
 Projects vector onto the target Vector. More...
 
template<vectorial TVector, class T >
requires std::is_arithmetic_v<T>
constexpr TVector lerp (TVector vector1, const TVector &vector2, T t)
 Computes the linear interpolation between both vectors for the parameter t (or extrapolation, when t is outside the range [0,1]). More...
 
template<vectorial TVector>
requires std::floating_point<vector_value_t<TVector>>
constexpr TVector inversed (TVector vector)
 Computes the inverse of the vector (1./v[0], 1./v[1], ...). More...
 

Variables

template<class T >
constexpr auto vector_dims_v = vector_traits<std::remove_cvref_t<T>>::dimensions
 Convenience constant to the dimensions of Vectors. More...
 
template<class T >
constexpr bool is_vectorial_v = is_vectorial<T>::value
 Shortcut checking for vectorial classes. More...