diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-29 17:40:04 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:57 +0200 |
commit | a039c8ad36779903571419cb06cd052f8fc41512 (patch) | |
tree | 4fdced6941a048bdd4b032fab7012bca00a6028e /src/engine/data/vector2.cpp | |
parent | acf72075ed32e5a679d49ffedc0c28d8ac2aea8b (diff) |
refactor: use trailing return types
Diffstat (limited to 'src/engine/data/vector2.cpp')
-rw-r--r-- | src/engine/data/vector2.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/engine/data/vector2.cpp b/src/engine/data/vector2.cpp index b838051..0554930 100644 --- a/src/engine/data/vector2.cpp +++ b/src/engine/data/vector2.cpp @@ -2,7 +2,7 @@ #include "util/hash.hpp" -Vector2::Value Vector2::get_x() const noexcept +auto Vector2::get_x() const noexcept -> Vector2::Value { return _x; } @@ -12,7 +12,7 @@ void Vector2::set_x(Vector2::Value x) noexcept _x = x; } -Vector2::Value Vector2::get_y() const noexcept +auto Vector2::get_y() const noexcept -> Vector2::Value { return _y; } @@ -22,13 +22,13 @@ void Vector2::set_y(Vector2::Value y) noexcept _y = y; } -Vector2 Vector2::to_direction(const Vector2 &direction, - Vector2::Value amount) const noexcept +auto Vector2::to_direction(const Vector2 &direction, + Vector2::Value amount) const noexcept -> Vector2 { return *this + (direction * Vector2({.x = amount, .y = amount})); } -const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept +auto Vector2::operator+=(const Vector2 &rhs) noexcept -> const Vector2 & { _x += rhs._x; _y += rhs._y; @@ -36,7 +36,7 @@ const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept return *this; } -const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept +auto Vector2::operator-=(const Vector2 &rhs) noexcept -> const Vector2 & { _x -= rhs._x; _y -= rhs._y; @@ -44,7 +44,7 @@ const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept return *this; } -Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept +auto Vector2::operator+(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -54,7 +54,7 @@ Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept +auto Vector2::operator-(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -64,7 +64,7 @@ Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept +auto Vector2::operator*(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = *this; @@ -74,12 +74,12 @@ Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept return new_vector2; } -bool Vector2::operator==(const Vector2 &rhs) const noexcept +auto Vector2::operator==(const Vector2 &rhs) const noexcept -> bool { return _x == rhs._x && _y == rhs._y; } -std::size_t Vector2Hasher::operator()(const Vector2 &vector2) const noexcept +auto Vector2Hasher::operator()(const Vector2 &vector2) const noexcept -> std::size_t { std::size_t result_hash = 0; |