#include <recti/vector2.hpp>
template<typename T1, typename T2 = T1>
Vector2 class
vector2
Constructors, destructors, conversion operators
Public functions
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
- Not 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 & -> CONSTEXPR14 auto
- Add.
-
template<typename U1, typename U2>auto operator-=(const Vector2<U1, U2>& other) -> Vector2 & -> CONSTEXPR14 auto
- Substract.
-
template<typename R>auto operator*=(const R& alpha) -> Vector2 & -> CONSTEXPR14 auto
- Multiply.
-
template<typename R>auto operator/=(const R& alpha) -> Vector2 & -> CONSTEXPR14 auto
- Divide.
-
template<typename U1, typename U2>auto operator+(Vector2 rhs, const Vector2<U1, U2>& lhs) -> Vector2 -> auto constexpr
- Add.
-
template<typename U1, typename U2>auto operator-(Vector2 rhs, const Vector2<U1, U2>& lhs) -> Vector2 -> auto constexpr
- Substract.
-
template<typename R>auto operator*(Vector2 rhs, const R& alpha) -> Vector2 -> auto constexpr
- Multiply by a scalar.
-
template<typename R>auto operator*(const R& alpha, Vector2 lhs) -> Vector2 -> auto constexpr
- Multiply (by a scalar)
-
template<typename R>auto operator/(Vector2 rhs, const R& alpha) -> Vector2 -> auto constexpr
- Divide (by a scalar)
Friends
-
template<class Stream>auto operator<<(Stream& out, const Vector2& vec2) -> Stream & -> auto
Function documentation
template<typename T1, typename T2>
recti:: Vector2<T1, T2>:: Vector2(T1&& vec_x,
T2&& vec_y) constexpr noexcept
Construct a new Vector2 object.
This is a constructor for the Vector2
class. It takes two parameters vec_x
and vec_y
, both of which are rvalue references (T1&&
and T2&&
). The constructor is marked as constexpr
, meaning it can be evaluated at compile-time. The constructor is also marked as noexcept
, indicating that it does not throw any exceptions.
template<typename T1, typename T2>
auto recti:: Vector2<T1, T2>:: x() const noexcept -> const T1 & constexpr
Returns | constexpr const T1& |
---|
template<typename T1, typename T2>
auto recti:: Vector2<T1, T2>:: y() const noexcept -> const T2 & constexpr
Returns | constexpr const T2& |
---|
template<typename T1, typename T2>
template<typename U1, typename U2>
auto recti:: 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 recti:: 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>
auto recti:: Vector2<T1, T2>:: operator-() const -> Vector2 constexpr
Negate.
Returns | vector2 |
---|
template<typename T1, typename T2>
template<typename U1, typename U2>
CONSTEXPR14 auto recti:: Vector2<T1, T2>:: operator+=(const Vector2<U1, U2>& other) -> Vector2 &
Add.
Template parameters | |
---|---|
U1 | |
U2 | |
Parameters | |
other in | |
Returns | Vector2& |
template<typename T1, typename T2>
template<typename U1, typename U2>
CONSTEXPR14 auto recti:: Vector2<T1, T2>:: operator-=(const Vector2<U1, U2>& other) -> Vector2 &
Substract.
Template parameters | |
---|---|
U1 | |
U2 | |
Parameters | |
other in | |
Returns | Vector2& |
template<typename T1, typename T2>
template<typename R>
CONSTEXPR14 auto recti:: Vector2<T1, T2>:: operator*=(const R& alpha) -> Vector2 &
Multiply.
Template parameters | |
---|---|
R | |
Parameters | |
alpha in | |
Returns | Vector2& |
template<typename T1, typename T2>
template<typename R>
CONSTEXPR14 auto recti:: Vector2<T1, T2>:: operator/=(const R& alpha) -> Vector2 &
Divide.
Template parameters | |
---|---|
R | |
Parameters | |
alpha in | |
Returns | Vector2& |
template<typename T1, typename T2>
template<class Stream>
auto operator<<(Stream& out,
const Vector2& vec2) -> Stream &
Template parameters | |
---|---|
Stream | |
Parameters | |
out out | |
vec2 | |
Returns | Stream& |