template<typename T1, typename T2 = T1>
numeric::vector2 class

vector2

Constructors, destructors, conversion operators

vector2(T1&& x, T2&& y) constexpr noexcept
Construct a new vector2 object.
vector2(const T1& x, const T2& y) constexpr
Construct a new vector2 object.
template<typename U1, typename U2>
vector2(const vector2<U1, U2>& other) constexpr
Construct a new vector2 object.

Public functions

auto _tie() const -> auto
auto x() const noexcept -> const T1 & -> auto constexpr
auto y() const noexcept -> const T2 & -> auto constexpr
template<typename U1, typename U2>
auto dot(const vector2<U1, U2>& other) const -> auto constexpr
template<typename U1, typename U2>
auto cross(const vector2<U1, U2>& other) const -> auto constexpr

Public variables

T1 _x
T2 _y

Comparison operators

definie ==, !=, <, >, <=, >=.

template<typename U1, typename U2>
auto operator==(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Equal to.
template<typename U1, typename U2>
auto operator<(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Less than.
template<typename U1, typename U2>
auto operator!=(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Not equal to.
template<typename U1, typename U2>
auto operator>(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Greater than.
template<typename U1, typename U2>
auto operator<=(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Less than or euqual to.
template<typename U1, typename U2>
auto operator>=(const vector2<U1, U2>& other) const -> bool -> auto constexpr
Greater than or equal to.

Arithmetic operators

definie +, -, *, /, +=, -=, *=, /=, etc.

auto operator-() const -> vector2 -> auto constexpr
Negate.
template<typename U1, typename U2>
auto operator+=(const vector2<U1, U2>& other) -> vector2 & -> auto constexpr
Add.
template<typename U1, typename U2>
auto operator-=(const vector2<U1, U2>& other) -> vector2 & -> auto constexpr
Substract.
template<typename R>
auto operator*=(const R& alpha) -> vector2 & -> auto constexpr
Multiply.
template<typename R>
auto operator/=(const R& alpha) -> vector2 & -> auto constexpr
Divide.
template<typename U1, typename U2>
auto operator+(vector2 x, const vector2<U1, U2>& y) -> vector2 -> friend auto constexpr
Add.
template<typename U1, typename U2>
auto operator-(vector2 x, const vector2<U1, U2>& y) -> vector2 -> friend auto constexpr
Substract.
template<typename R>
auto operator*(vector2 x, const R& alpha) -> vector2 -> friend auto constexpr
Multiply by a scalar.
template<typename R>
auto operator*(const R& alpha, vector2 x) -> vector2 -> friend auto constexpr
Multiply (by a scalar)
template<typename R>
auto operator/(vector2 x, const R& alpha) -> vector2 -> friend auto constexpr
Divide (by a scalar)

Friends

template<class Stream>
auto operator<<(Stream& out, const vector2& v) -> Stream & -> auto

Function documentation

template<typename T1, typename T2>
numeric::vector2<T1, T2>::vector2(T1&& x, T2&& y) constexpr noexcept

Construct a new vector2 object.

Parameters
x
y

template<typename T1, typename T2>
numeric::vector2<T1, T2>::vector2(const T1& x, const T2& y) constexpr

Construct a new vector2 object.

Parameters
x
y

template<typename T1, typename T2> template<typename U1, typename U2>
numeric::vector2<T1, T2>::vector2(const vector2<U1, U2>& other) constexpr

Construct a new vector2 object.

Template parameters
U1
U2

template<typename T1, typename T2>
auto numeric::vector2<T1, T2>::x() const noexcept -> const T1 & constexpr

Returns constexpr const T1&

template<typename T1, typename T2>
auto numeric::vector2<T1, T2>::y() const noexcept -> const T2 & constexpr

Returns constexpr const T2&

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::dot(const vector2<U1, U2>& other) const constexpr

Template parameters
U1
U2
Parameters
other in
Returns constexpr auto

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::cross(const vector2<U1, U2>& other) const constexpr

Template parameters
U1
U2
Parameters
other in
Returns constexpr auto

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator==(const vector2<U1, U2>& other) const -> bool constexpr

Equal to.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator<(const vector2<U1, U2>& other) const -> bool constexpr

Less than.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator!=(const vector2<U1, U2>& other) const -> bool constexpr

Not equal to.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator>(const vector2<U1, U2>& other) const -> bool constexpr

Greater than.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator<=(const vector2<U1, U2>& other) const -> bool constexpr

Less than or euqual to.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator>=(const vector2<U1, U2>& other) const -> bool constexpr

Greater than or equal to.

Template parameters
U1
U2
Parameters
other in
Returns true

template<typename T1, typename T2>
auto numeric::vector2<T1, T2>::operator-() const -> vector2 constexpr

Negate.

Returns vector2

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator+=(const vector2<U1, U2>& other) -> vector2 & constexpr

Add.

Template parameters
U1
U2
Parameters
other in
Returns vector2&

template<typename T1, typename T2> template<typename U1, typename U2>
auto numeric::vector2<T1, T2>::operator-=(const vector2<U1, U2>& other) -> vector2 & constexpr

Substract.

Template parameters
U1
U2
Parameters
other in
Returns vector2&

template<typename T1, typename T2> template<typename R>
auto numeric::vector2<T1, T2>::operator*=(const R& alpha) -> vector2 & constexpr

Multiply.

Template parameters
R
Parameters
alpha in
Returns vector2&

template<typename T1, typename T2> template<typename R>
auto numeric::vector2<T1, T2>::operator/=(const R& alpha) -> vector2 & constexpr

Divide.

Template parameters
R
Parameters
alpha in
Returns vector2&

template<typename T1, typename T2> template<typename U1, typename U2>
friend auto numeric::vector2<T1, T2>::operator+(vector2 x, const vector2<U1, U2>& y) -> vector2 constexpr

Add.

Template parameters
U1
U2
Parameters
in
in
Returns vector2

template<typename T1, typename T2> template<typename U1, typename U2>
friend auto numeric::vector2<T1, T2>::operator-(vector2 x, const vector2<U1, U2>& y) -> vector2 constexpr

Substract.

Template parameters
U1
U2
Parameters
in
in
Returns vector2

template<typename T1, typename T2> template<typename R>
friend auto numeric::vector2<T1, T2>::operator*(vector2 x, const R& alpha) -> vector2 constexpr

Multiply by a scalar.

Template parameters
R
Parameters
in
alpha in
Returns vector2

template<typename T1, typename T2> template<typename R>
friend auto numeric::vector2<T1, T2>::operator*(const R& alpha, vector2 x) -> vector2 constexpr

Multiply (by a scalar)

Template parameters
R
Parameters
alpha in
in
Returns vector2

template<typename T1, typename T2> template<typename R>
friend auto numeric::vector2<T1, T2>::operator/(vector2 x, const R& alpha) -> vector2 constexpr

Divide (by a scalar)

Template parameters
R
Parameters
in
alpha in
Returns vector2

template<typename T1, typename T2> template<class Stream>
auto operator<<(Stream& out, const vector2& v) -> Stream &

Template parameters
Stream
Parameters
out out
in
Returns Stream&