template<size_t Dimensions, typename T, bool Owner = true>
nd_vector_impl class
Contents
Represents an N-dimensional, discrete field of values of a type. Depending on how the contained data is interpreted, this class can represent a coordinate, a colour, a transformation matrix, an image or an abstract, higher-dimensional collection of elements.
Constructors, destructors, conversion operators
- nd_vector_impl() constexpr
- nd_vector_impl(T*const data, std::array<size_t, Dimensions> shape) constexpr
-
nd_vector_impl(nd_
vector_ impl const& other) constexpr
Public functions
- auto dimensions() const -> size_t constexpr
- auto shape() const -> const std::array<size_t, Dimensions>&
- auto size() const -> size_t
- auto data() -> gsl::span<T> constexpr
- auto data() const -> gsl::span<T const > constexpr
-
auto operator=(nd_
vector_ impl const& other) -> nd_ vector_ impl& -
auto operator=(T const& value) -> nd_
vector_ impl& -
auto reset(nd_
vector_ impl const& other) -> nd_ vector_ impl& - Reassigns the data pointer to refer to
other
s data and resets the size accordingly. -
template<bool Enabled = Dimensions == 1, std::enable_if_t<Enabled, int> = 0>auto operator[](size_t index) -> T&
-
template<bool Enabled = Dimensions == 1, std::enable_if_t<Enabled, int> = 0>auto operator[](size_t index) const -> const T&
-
template<bool Enabled = (Dimensions> 1), std::enable_if_t<Enabled, int> = 0>auto operator[](size_t index) -> nd_
vector_ impl<Dimensions - 1, T, false> -
template<bool Enabled = (Dimensions> 1), std::enable_if_t<Enabled, int> = 0>auto operator[](size_t index) const -> const nd_
vector_ impl<Dimensions - 1, T, false> -
template<typename ... Ts, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>auto operator()(Ts... indeces) -> nd_
vector_ impl<Dimensions - sizeof...(Ts), T, false> -
template<typename ... Ts, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>auto operator()(Ts... indeces) const -> const nd_
vector_ impl<Dimensions - sizeof...(Ts), T, false> -
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>auto operator()(Ts... indeces) -> T&
-
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>auto operator()(Ts... indeces) const -> const T&
-
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>auto at(Ts... indeces) -> nd_
vector_ impl<Dimensions - sizeof...(Ts), T, false> -
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>auto at(Ts... indeces) const -> const nd_
vector_ impl<Dimensions - sizeof...(Ts), T, false> -
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>auto at(Ts... indeces) -> T&
-
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>auto at(Ts... indeces) const -> const T&
-
template<bool Owner_other>auto operator+=(nd_
vector_ impl<Dimensions, T, Owner_other> const& rhs) -> nd_ vector_ impl<Dimensions, T, Owner>& -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator+=(T_scalar const& rhs) -> nd_
vector_ impl<Dimensions, T, Owner>& -
template<bool Owner_other>auto operator-=(nd_
vector_ impl<Dimensions, T, Owner_other> const& rhs) -> nd_ vector_ impl<Dimensions, T, Owner>& -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator-=(T_scalar const& rhs) -> nd_
vector_ impl<Dimensions, T, Owner>& -
template<bool Owner_other>auto operator*=(nd_
vector_ impl<Dimensions, T, Owner_other> const& rhs) -> nd_ vector_ impl<Dimensions, T, Owner>& -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator*=(T_scalar const& rhs) -> nd_
vector_ impl<Dimensions, T, Owner>& -
template<bool Owner_other>auto operator/=(nd_
vector_ impl<Dimensions, T, Owner_other> const& rhs) -> nd_ vector_ impl<Dimensions, T, Owner>& -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator/=(T_scalar const& rhs) -> nd_
vector_ impl<Dimensions, T, Owner>&
Friends
-
auto operator==(nd_
vector_ impl const& lhs, nd_ vector_ impl const& rhs) -> bool -
auto operator!=(nd_
vector_ impl const& lhs, nd_ vector_ impl const& rhs) -> bool -
auto operator==(nd_
vector_ impl const& lhs, T const*const rhs) -> bool -
auto operator!=(nd_
vector_ impl const& lhs, T const*const rhs) -> bool -
auto operator==(T const*const lhs,
nd_
vector_ impl const& rhs) -> bool -
auto operator!=(T const*const lhs,
nd_
vector_ impl const& rhs) -> bool -
template<bool Owner_rhs>auto operator+(nd_
vector_ impl<Dimensions, T, true> lhs, nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator+(nd_
vector_ impl<Dimensions, T, true> lhs, T_scalar const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator+(T_scalar const& lhs, nd_
vector_ impl<Dimensions, T, true> rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<bool Owner_rhs>auto operator-(nd_
vector_ impl<Dimensions, T, true> lhs, nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator-(nd_
vector_ impl<Dimensions, T, true> lhs, T_scalar const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator-(T_scalar const& lhs, nd_
vector_ impl<Dimensions, T, true> rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<bool Owner_rhs>auto operator*(nd_
vector_ impl<Dimensions, T, true> lhs, nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator*(nd_
vector_ impl<Dimensions, T, true> lhs, T_scalar const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator*(T_scalar const& lhs, nd_
vector_ impl<Dimensions, T, true> rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<bool Owner_rhs>auto operator/(nd_
vector_ impl<Dimensions, T, true> lhs, nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator/(nd_
vector_ impl<Dimensions, T, true> lhs, T_scalar const& rhs) -> nd_ vector_ impl<Dimensions, T, true> -
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>auto operator/(T_scalar const& lhs, nd_
vector_ impl<Dimensions, T, true> rhs) -> nd_ vector_ impl<Dimensions, T, true> -
auto operator<<(std::ostream& os,
nd_
vector_ impl const& vec) -> std::ostream&
Function documentation
template<size_tDimensions, typenameT, boolOwner>
spice:: nd_vector_impl<Dimensions, T, Owner>:: nd_vector_impl() constexpr
Constructs an nd_vector measuring 0 in every dimension, thus containing no values.
template<size_tDimensions, typenameT, boolOwner>
spice:: nd_vector_impl<Dimensions, T, Owner>:: nd_vector_impl(T*const data,
std::array<size_t, Dimensions> shape) constexpr
Constructs a fresh nd_vector with the supplied data and shape. Owning nd_vectors will take ownership of the pointer, non-owning nd_vectors will leave resource management to the caller.
template<size_tDimensions, typenameT, boolOwner>
spice:: nd_vector_impl<Dimensions, T, Owner>:: nd_vector_impl(nd_ vector_ impl const& other) constexpr
Constructs an nd_vector from another, reusing the other's buffer. This is overridden for owning nd_vectors to create a new buffer.
template<size_tDimensions, typenameT, boolOwner>
size_t spice:: nd_vector_impl<Dimensions, T, Owner>:: dimensions() const constexpr
Returns | The number of dimensions as specified by the template |
---|
template<size_tDimensions, typenameT, boolOwner>
const std::array<size_t, Dimensions>& spice:: nd_vector_impl<Dimensions, T, Owner>:: shape() const
Returns | The shape array describing this nd_vector |
---|
The shape of an nd_vector is its size in each of the dimensions. The interpretation of the semantics of said shape is up to the user.
template<size_tDimensions, typenameT, boolOwner>
size_t spice:: nd_vector_impl<Dimensions, T, Owner>:: size() const
Returns | The total number of elements |
---|
Calculates the total number of elements contained in this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
gsl::span<T> spice:: nd_vector_impl<Dimensions, T, Owner>:: data() constexpr
Allows accessing the underlying data directly.
template<size_tDimensions, typenameT, boolOwner>
gsl::span<T const > spice:: nd_vector_impl<Dimensions, T, Owner>:: data() const constexpr
Allows accessing the underlying data directly. The data is returned in terms of a one-dimensional, non-owning nd_vector.
template<size_tDimensions, typenameT, boolOwner>
nd_ vector_ impl& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator=(nd_ vector_ impl const& other)
Copies the values from other
to this
. Only values included in the intersection of the shapes of other
and this
are copied, the shape of this
is not adjusted.
template<size_tDimensions, typenameT, boolOwner>
nd_ vector_ impl& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator=(T const& value)
Moves the data from other
to this
, resizing the object as necessary.
Sets all values of this
equal to value
. The current shape is retained.
template<size_tDimensions, typenameT, boolOwner>
nd_ vector_ impl& spice:: nd_vector_impl<Dimensions, T, Owner>:: reset(nd_ vector_ impl const& other)
Reassigns the data pointer to refer to other
s data and resets the size accordingly.
Parameters | |
---|---|
other | |
Returns | nd_*this |
template<size_tDimensions, typenameT, boolOwner>
template<bool Enabled = Dimensions == 1, std::enable_if_t<Enabled, int> = 0>
T& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator[](size_t index)
Parameters | |
---|---|
index | The index of the element to retrieve |
Returns | A reference to an element in the nd_vector |
Returns an element from the nd_vector.
Calling my_image[42][47][2]
on an nd_vector representing an RGB image would return the blue channel value in column 43 (index 42), row 48 of the image.
template<size_tDimensions, typenameT, boolOwner>
template<bool Enabled = Dimensions == 1, std::enable_if_t<Enabled, int> = 0>
const T& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator[](size_t index) const
Parameters | |
---|---|
index | The index of the element to retrieve |
Returns | A reference to an element in the nd_vector |
Returns an element from the nd_vector.
Calling my_image[42][47][2]
on an nd_vector representing an RGB image would return the blue channel value in column 43 (index 42), row 48 of the image.
template<size_tDimensions, typenameT, boolOwner>
template<bool Enabled = (Dimensions> 1), std::enable_if_t<Enabled, int> = 0>
nd_ vector_ impl<Dimensions - 1, T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: operator[](size_t index)
Parameters | |
---|---|
index | The index of the column to retrieve a view for |
Returns | A non-owning nd_vector of decremented dimensionality referring to the dimensional slice indicated by the index. |
Returns a view into the nd_vector. This view will be a non-owning nd_vector of dimensionality Dimensions - 1
.
Calling my_image[42][47]
on an nd_vector representing an RGB image would return a one-dimensional nd_vector
representing the colour in column 43 (index 42), row 48 of the image.
template<size_tDimensions, typenameT, boolOwner>
template<bool Enabled = (Dimensions> 1), std::enable_if_t<Enabled, int> = 0>
const nd_ vector_ impl<Dimensions - 1, T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: operator[](size_t index) const
Parameters | |
---|---|
index | The index of the dimension to retrieve a view for |
Returns | A non-owning nd_vector of decremented dimensionality referring to the dimensional slice indicated by the index. |
Returns a view into the nd_vector. This view will be a non-owning nd_vector of dimensionality Dimensions - 1
.
Calling my_image[42][47]
on an nd_vector representing an RGB image would return a one-dimensional nd_vector
representing the colour in column 43 (index 42), row 48 of the image.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>
nd_ vector_ impl<Dimensions - sizeof...(Ts), T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: operator()(Ts... indeces)
Parameters | |
---|---|
indeces | The coordinates to retrieve the slice from |
Returns | A non-owning nd_vector of the same type and dimension n - m where n is the dimensionality of this vector and m the count of arguments passed to this function. |
Creates a non-owning nd_vector referring to a lower-dimensional slice of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>
const nd_ vector_ impl<Dimensions - sizeof...(Ts), T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: operator()(Ts... indeces) const
Parameters | |
---|---|
indeces | The coordinates to retrieve the slice from |
Returns | A non-owning nd_vector of the same type and dimension n - m where n is the dimensionality of this vector and m the count of arguments passed to this function. |
Creates a non-owning nd_vector referring to a lower-dimensional slice of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>
T& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator()(Ts... indeces)
Parameters | |
---|---|
indeces | The coordinates to retrieve the element from |
Returns | A reference to an element in the nd_vector |
Retrieves a reference to an element of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>
const T& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator()(Ts... indeces) const
Parameters | |
---|---|
indeces | The coordinates to retrieve the element from |
Returns | A const reference to an element in the nd_vector |
Retrieves a reference to an element of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>
nd_ vector_ impl<Dimensions - sizeof...(Ts), T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: at(Ts... indeces)
Parameters | |
---|---|
indeces | The coordinates to retrieve the slice from |
Returns | A non-owning nd_vector of the same type and dimension n - m where n is the dimensionality of this vector and m the count of arguments passed to this function. |
Exceptions | |
std::out_of_range | if the supplied coordinates are not located inside the bounds of this nd_vector as supplied by nd_vector:: . |
Creates a non-owning nd_vector referring to a lower-dimensional slice of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<(sizeof...(Ts)<Dimensions), int> = 0>
const nd_ vector_ impl<Dimensions - sizeof...(Ts), T, false> spice:: nd_vector_impl<Dimensions, T, Owner>:: at(Ts... indeces) const
Parameters | |
---|---|
indeces | The coordinates to retrieve the slice from |
Returns | A non-owning nd_vector of the same type and dimension n - m where n is the dimensionality of this vector and m the count of arguments passed to this function. |
Exceptions | |
std::out_of_range | if the supplied coordinates are not located inside the bounds of this nd_vector as supplied by nd_vector:: . |
Creates a non-owning nd_vector referring to a lower-dimensional slice of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>
T& spice:: nd_vector_impl<Dimensions, T, Owner>:: at(Ts... indeces)
Parameters | |
---|---|
indeces | The coordinates to retrieve the element from |
Returns | A reference to an element in the nd_vector |
Exceptions | |
std::out_of_range | if the supplied coordinates are not located inside the bounds of this nd_vector as supplied by nd_vector:: . |
Retrieves a reference to an element of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename ... Ts, class = std::common_type_t<Ts...>, std::enable_if_t<sizeof...(Ts)==Dimensions, int> = 0>
const T& spice:: nd_vector_impl<Dimensions, T, Owner>:: at(Ts... indeces) const
Parameters | |
---|---|
indeces | The coordinates to retrieve the element from |
Returns | A reference to an element in the nd_vector |
Exceptions | |
std::out_of_range | if the supplied coordinates are not located inside the bounds of this nd_vector as supplied by nd_vector:: . |
Retrieves a reference to an element of this nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_other>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator+=(nd_ vector_ impl<Dimensions, T, Owner_other> const& rhs)
Adds the first nd_vector element-wise to the second. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator+=(T_scalar const& rhs)
Adds the scalar rhs
argument to each element of the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_other>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator-=(nd_ vector_ impl<Dimensions, T, Owner_other> const& rhs)
Subtracts the first nd_vector element-wise from the second. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator-=(T_scalar const& rhs)
Subtracts the scalar rhs
argument from each element of the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_other>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator*=(nd_ vector_ impl<Dimensions, T, Owner_other> const& rhs)
Multiplies the first nd_vector element-wise with the second. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator*=(T_scalar const& rhs)
Multiplies each element of the nd_vector with the scalar rhs
argument.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_other>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator/=(nd_ vector_ impl<Dimensions, T, Owner_other> const& rhs)
Divides the first nd_vector element-wise from the second. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, Owner>& spice:: nd_vector_impl<Dimensions, T, Owner>:: operator/=(T_scalar const& rhs)
Divides each element of the nd_vector by the scalar rhs
argument.
template<size_tDimensions, typenameT, boolOwner>
bool operator==(nd_ vector_ impl const& lhs,
nd_ vector_ impl const& rhs)
Compares two nd_vectors with one another. Two nd_vectors are considered to be equal if they have the same shape and contain the same data.
template<size_tDimensions, typenameT, boolOwner>
bool operator!=(nd_ vector_ impl const& lhs,
nd_ vector_ impl const& rhs)
Compares two nd_vectors with one another. operator!=
is implemented as the negation of nd_vector::
.
template<size_tDimensions, typenameT, boolOwner>
bool operator==(nd_ vector_ impl const& lhs,
T const*const rhs)
Compares an nd_vector with a pointer type. They are considered to be equal if the pointer points to the same address as the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
bool operator!=(nd_ vector_ impl const& lhs,
T const*const rhs)
Compares an nd_vector with a pointer type. operator!=
is implemented as the negation of nd_vector::
.
template<size_tDimensions, typenameT, boolOwner>
bool operator==(T const*const lhs,
nd_ vector_ impl const& rhs)
Compares an nd_vector with a pointer type. They are considered to be equal if the pointer points to the same address as the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
bool operator!=(T const*const lhs,
nd_ vector_ impl const& rhs)
Compares an nd_vector with a pointer type. operator!=
is implemented as the negation of nd_vector::
.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_rhs>
nd_ vector_ impl<Dimensions, T, true> operator+(nd_ vector_ impl<Dimensions, T, true> lhs,
nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs)
Adds the two nd_vectors element-wise. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator+(nd_ vector_ impl<Dimensions, T, true> lhs,
T_scalar const& rhs)
Adds the scalar rhs
argument to each element of the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator+(T_scalar const& lhs,
nd_ vector_ impl<Dimensions, T, true> rhs)
Adds the scalar lhs
argument to each element of the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_rhs>
nd_ vector_ impl<Dimensions, T, true> operator-(nd_ vector_ impl<Dimensions, T, true> lhs,
nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs)
Subtracts the two nd_vectors element-wise. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator-(nd_ vector_ impl<Dimensions, T, true> lhs,
T_scalar const& rhs)
Subtracts the scalar rhs
argument from each element of the nd_vector.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator-(T_scalar const& lhs,
nd_ vector_ impl<Dimensions, T, true> rhs)
Subtracts the scalar from each element of the nd_vector, returning an nd_vector containing the resulting values.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_rhs>
nd_ vector_ impl<Dimensions, T, true> operator*(nd_ vector_ impl<Dimensions, T, true> lhs,
nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs)
Multiplies the two nd_vectors element-wise. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator*(nd_ vector_ impl<Dimensions, T, true> lhs,
T_scalar const& rhs)
Multiplies each element of the nd_vector with the scalar rhs
argument.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator*(T_scalar const& lhs,
nd_ vector_ impl<Dimensions, T, true> rhs)
Multiplies each element of the nd_vector with the scalar lhs
argument.
template<size_tDimensions, typenameT, boolOwner>
template<bool Owner_rhs>
nd_ vector_ impl<Dimensions, T, true> operator/(nd_ vector_ impl<Dimensions, T, true> lhs,
nd_ vector_ impl<Dimensions, T, Owner_rhs> const& rhs)
Divides the two nd_vectors element-wise. If the two nd_vectors have different dimensions, only the overlapping parts will be taken into account. The nd_vectors will be aligned by their top-left corners.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator/(nd_ vector_ impl<Dimensions, T, true> lhs,
T_scalar const& rhs)
Divides each element of the nd_vector by the scalar rhs
argument.
template<size_tDimensions, typenameT, boolOwner>
template<typename T_scalar, typename = std::enable_if_t<std::is_arithmetic<T_scalar>::value>>
nd_ vector_ impl<Dimensions, T, true> operator/(T_scalar const& lhs,
nd_ vector_ impl<Dimensions, T, true> rhs)
Divides the scalar by each element of the nd_vector, returning an nd_vector containing the resulting values.
template<size_tDimensions, typenameT, boolOwner>
std::ostream& operator<<(std::ostream& os,
nd_ vector_ impl const& vec)
Prints a representation of the nd_vector of the form nd_
to the proVided stream.