aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-08 00:31:55 -0700
committerChris Robinson <[email protected]>2019-09-08 00:31:55 -0700
commitfcb496bb5c8735a9a1efc926bd0caa8657bbaf5e (patch)
tree31dc6723a1617421db8d2a743b4b7ee5c475279e
parent987fd13796d5761b7adc5f6e137e7a6149d02f7b (diff)
Avoid unnecessary explicit copy methods
-rw-r--r--common/vecmat.h24
1 files 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<float,4> mVals{};
+ alignas(16) std::array<float,4> 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<std::array<float,4>,4> mVals{};
+ alignas(16) std::array<std::array<float,4>,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<float,4>& operator[](size_t idx) noexcept { return mVals[idx]; }
constexpr const std::array<float,4>& operator[](size_t idx) const noexcept { return mVals[idx]; }