numeric::Vector2Ref class

Vector2Ref.

Constructors, destructors, conversion operators

Vector2Ref(double& x, double& y) constexpr noexcept
Construct a new Vector2Ref object.

Public functions

auto x() const noexcept -> const double & -> auto constexpr
auto y() const noexcept -> const double & -> auto constexpr
auto dot(const Vector2Ref& other) const -> double -> auto constexpr
auto cross(const Vector2Ref& other) const -> double -> auto constexpr

Public variables

double& _x
double& _y

Arithmetic operators

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

auto operator+=(const Vector2Ref& other) -> Vector2Ref & -> CONSTEXPR14 auto
auto operator-=(const Vector2Ref& other) -> Vector2Ref & -> CONSTEXPR14 auto
auto operator*=(const double& alpha) -> Vector2Ref & -> CONSTEXPR14 auto
auto operator/=(const double& alpha) -> Vector2Ref & -> CONSTEXPR14 auto

Friends

template<class Stream>
auto operator<<(Stream& out, const Vector2Ref& vec) -> Stream & -> auto

Function documentation

numeric::Vector2Ref::Vector2Ref(double& x, double& y) constexpr noexcept

Construct a new Vector2Ref object.

Parameters
in The parameter x is of type double&&, which means it is a forwarding reference. It can accept any type, and it is passed as an rvalue reference. This allows the constructor to efficiently move or forward the value of x into the _x member variable.
in The parameter "y" is the y-coordinate of the Vector2Ref object. It represents the vertical position of the vector in a 2D coordinate system.

The function constructs a new Vector2Ref object with given x and y values.

auto numeric::Vector2Ref::x() const noexcept -> const double & constexpr

Returns a reference to a constant object of type double.

The function returns a reference to a constant value of type double.

auto numeric::Vector2Ref::y() const noexcept -> const double & constexpr

Returns a reference to a constant object of type double.

The function y() returns a reference to a constant value of type double.

auto numeric::Vector2Ref::dot(const Vector2Ref& other) const -> double constexpr

Parameters
other in The parameter "other" is a reference to an object of type Vector2Ref<U1, U2>.
Returns The dot function is returning the dot product of two vectors, which is a scalar value of type double.

The dot function calculates the dot product of two 2D vectors.

auto numeric::Vector2Ref::cross(const Vector2Ref& other) const -> double constexpr

Parameters
other in The parameter "other" is a reference to an object of type Vector2Ref<U1, U2>.
Returns The function cross returns the result of the cross product between the current vector and the other vector. The result is of type double.

The cross product of two 2D vectors is calculated by multiplying their x and y components and subtracting the result.

CONSTEXPR14 auto numeric::Vector2Ref::operator+=(const Vector2Ref& other) -> Vector2Ref &

Parameters
other in The parameter "other" is a reference to an object of type Vector2Ref<U1, U2>.
Returns a reference to a Vector2Ref object.

The function operator+= adds the components of another Vector2Ref object to the current Vector2Ref object and returns a reference to the updated object.

CONSTEXPR14 auto numeric::Vector2Ref::operator-=(const Vector2Ref& other) -> Vector2Ref &

Parameters
other in The parameter "other" is a reference to an object of type Vector2Ref<U1, U2>.
Returns a reference to a Vector2Ref object.

The function subtracts the x and y components of another Vector2Ref object from the current Vector2Ref object.

CONSTEXPR14 auto numeric::Vector2Ref::operator*=(const double& alpha) -> Vector2Ref &

Parameters
alpha in alpha is a constant reference to a variable of type R.
Returns The operator*= function returns a reference to the modified Vector2Ref object.

The function multiplies the x and y components of a Vector2Ref object by a given value.

CONSTEXPR14 auto numeric::Vector2Ref::operator/=(const double& alpha) -> Vector2Ref &

Parameters
alpha in The parameter "alpha" is of type R, which is a template parameter. It represents the value by which the x and y components of the Vector2Ref object are divided.
Returns a reference to the current instance of the Vector2Ref class.

The function divides the x and y components of a Vector2Ref object by a given value.

template<class Stream>
auto operator<<(Stream& out, const Vector2Ref& vec) -> Stream &

Template parameters
Stream
Parameters
out out The parameter "out" is a reference to a Stream object. It is used to output the contents of the Vector2Ref object to the stream.
vec in The parameter vec is a constant reference to an object of type Vector2Ref.
Returns The return type of the operator<< function is Stream&.

The above function overloads the << operator to output a Vector2Ref object in the format "{x, y}".