From 1063f1ff29681c2ed60c663bcbc28ddc634d4479 Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Mon, 11 Jan 2021 00:25:51 -0800 Subject: [PATCH] vec2 bool comparisons should be const --- include/blah/math/vec2.h | 4 ++-- src/math/vec2.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/blah/math/vec2.h b/include/blah/math/vec2.h index 8f4c51a..4e872b5 100644 --- a/include/blah/math/vec2.h +++ b/include/blah/math/vec2.h @@ -31,8 +31,8 @@ namespace Blah Vec2& operator /=(float rhs); Vec2& operator *=(float rhs); - bool operator ==(const Vec2& rhs); - bool operator !=(const Vec2& rhs); + bool operator ==(const Vec2& rhs) const; + bool operator !=(const Vec2& rhs) const; Vec2 normal() const; Vec2 turn_right() const; diff --git a/src/math/vec2.cpp b/src/math/vec2.cpp index 4518fad..6ad6c82 100644 --- a/src/math/vec2.cpp +++ b/src/math/vec2.cpp @@ -25,8 +25,8 @@ Vec2& Vec2::operator *=(const Vec2& rhs) { x *= rhs.x; y *= rhs.y; return *this; Vec2& Vec2::operator/=(float rhs) { x /= rhs; y /= rhs; return *this; } Vec2& Vec2::operator*=(float rhs) { x *= rhs; y *= rhs; return *this; } -bool Vec2::operator ==(const Vec2& rhs) { return x == rhs.x && y == rhs.y; } -bool Vec2::operator !=(const Vec2& rhs) { return x != rhs.x || y != rhs.y; } +bool Vec2::operator ==(const Vec2& rhs) const { return x == rhs.x && y == rhs.y; } +bool Vec2::operator !=(const Vec2& rhs) const { return x != rhs.x || y != rhs.y; } Vec2 Vec2::normal() const {