Skip to content

Commit 5eeb0b2

Browse files
authored
Merge pull request #11 from cpp-gamedev/bugfix
fix - operator function
2 parents 27fd17f + 2533323 commit 5eeb0b2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tray/src/tray/vec.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ class Vec {
5353
constexpr Type& z() requires(Dim > 2) { return at(2); }
5454
constexpr Type const& z() const requires(Dim > 2) { return at(2); }
5555

56-
constexpr Vec& operator-() requires(!std::is_unsigned_v<Type>) {
57-
for (auto& value : m_values) { value = -value; }
58-
return *this;
59-
}
56+
6057

6158
constexpr Vec& operator+=(Vec const& rhs) {
6259
for_each(*this, [&rhs](std::size_t i, Type& value) { value += rhs.at(i); });
@@ -100,7 +97,7 @@ class Vec {
10097

10198
friend constexpr Vec operator-(Vec const& v) {
10299
auto ret = v;
103-
ret = -ret;
100+
for (auto& value : ret.m_values) { value = -value; }
104101
return ret;
105102
}
106103

0 commit comments

Comments
 (0)