msl 1.3.0
Loading...
Searching...
No Matches
msl::Vector< N, T > Class Template Reference

Detailed Description

template<std::size_t N, typename T>
class msl::Vector< N, T >

A vector of arithmetic types.

#include <Vector.h>

Public Types

using Container = std::array<T, N>
 Underlying container.
using value_type = typename Container::value_type
 Stored value.
using const_iterator = typename Container::const_iterator
 Constant iterator to values.
using iterator = typename Container::iterator
 Iterator to values.

Public Member Functions

 Vector ()
 Zero-initialize the values.
 Vector (std::initializer_list< T > &&initializer)
 Initialize the values to given sequence.
template<typename T2>
 Vector (T2 x)
 Initialize the values from one scalar.
template<typename T2, typename T3>
 Vector (T2 const &x, T3 const &y)
 Initialize the values from two scalars.
template<typename T2, typename T3, typename T4>
 Vector (T2 const &x, T3 const &y, T4 const &z)
 Initialize the values from three scalars.
 Vector (Vector< N, T > const &)=default
 Vector (Vector< N, T > &&)=default
Vector< N, T > & operator= (Vector< N, T > const &)=default
Vector< N, T > & operator= (Vector< N, T > &&)=default
bool operator== (Vector< N, T > const &other) const
 Test equality of all elements.
bool operator!= (Vector< N, T > const &other) const
 Test difference of any element.
constexpr std::size_t size () const
 Return the number of elements.
T const & operator[] (std::size_t i) const
 Access an element.
T & operator[] (std::size_t i)
 Access an element.
Vector< N, T > & operator+= (Vector< N, T > const &right)
 Element-wise in-place addition.
Vector< N, T > & operator-= (Vector< N, T > const &right)
 Element-wise in-place subtraction.
Vector< N, T > & operator*= (T scalar)
 In-place multiplication by a scalar.
Vector< N, T > & operator/= (T right)
 In-place division by a scalar.
Vector< N, T > & operator%= (Vector< N, T > const &right)
 Elementwise in-place remainder of division.
Vector< N, T > & operator%= (T right)
 In-place remainder of division by a scalar.
Vector< N, T > const & operator+ () const
 Identity operator.
Vector< N, T > operator- () const
 Opposite operator.
norm () const
 Euclidean norm (i.e. L2 norm).
const_iterator begin () const
 Constant iterator to the first element.
const_iterator end () const
 Constant iterator after the last element.
const_iterator cbegin () const
 Constant iterator to the first element.
const_iterator cend () const
 Constant iterator after the last element.
iterator begin ()
 Iterator to the first element.
iterator end ()
 Iterator after the last element.
template<typename Dest>
Vector< N, Dest > cast () const
 Element-wise cast.

Constructor & Destructor Documentation

◆ Vector()

template<std::size_t N, typename T>
msl::Vector< N, T >::Vector ( std::initializer_list< T > && initializer)

Initialize the values to given sequence.

Extra values are skipped, missing values are 0-filled


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