From a039c8ad36779903571419cb06cd052f8fc41512 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 29 Mar 2022 17:40:04 +0200 Subject: refactor: use trailing return types --- src/engine/data/vector2.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/engine/data/vector2.cpp') 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; -- cgit v1.2.3-18-g5258