From fcb496bb5c8735a9a1efc926bd0caa8657bbaf5e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 8 Sep 2019 00:31:55 -0700 Subject: Avoid unnecessary explicit copy methods --- common/vecmat.h | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/common/vecmat.h b/common/vecmat.h index 83f1381e..7186ec6c 100644 --- a/common/vecmat.h +++ b/common/vecmat.h @@ -10,21 +10,13 @@ namespace alu { class Vector { - alignas(16) std::array mVals{}; + alignas(16) std::array mVals; public: - constexpr Vector() noexcept = default; + Vector() noexcept = default; constexpr Vector(float a, float b, float c, float d) noexcept : mVals{{a, b, c, d}} { } - Vector(const Vector &rhs) noexcept - { mVals = rhs.mVals; } - - Vector& operator=(const Vector &rhs) noexcept - { - mVals = rhs.mVals; - return *this; - } float& operator[](size_t idx) noexcept { return mVals[idx]; } constexpr const float& operator[](size_t idx) const noexcept { return mVals[idx]; } @@ -55,24 +47,16 @@ public: }; class Matrix { - alignas(16) std::array,4> mVals{}; + alignas(16) std::array,4> mVals; public: - constexpr Matrix() noexcept = default; + Matrix() noexcept = default; constexpr Matrix(float aa, float ab, float ac, float ad, float ba, float bb, float bc, float bd, float ca, float cb, float cc, float cd, float da, float db, float dc, float dd) noexcept : mVals{{{{aa, ab, ac, ad}}, {{ba, bb, bc, bd}}, {{ca, cb, cc, cd}}, {{da, db, dc, dd}}}} { } - Matrix(const Matrix &rhs) noexcept - { mVals = rhs.mVals; } - - Matrix& operator=(const Matrix &rhs) noexcept - { - mVals = rhs.mVals; - return *this; - } std::array& operator[](size_t idx) noexcept { return mVals[idx]; } constexpr const std::array& operator[](size_t idx) const noexcept { return mVals[idx]; } -- cgit v1.2.3