Skip to content

Commit 5fef049

Browse files
fix(sourcepp): remove vector constructors to make struct trivial again
1 parent b0bb376 commit 5fef049

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

include/sourcepp/math/Vector.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
#pragma once
22

3+
#include <array>
34
#include <cmath>
45

56
#include "Integer.h"
67

78
namespace sourcepp::math {
89

910
template<uint8_t S, Arithmetic P>
10-
class Vec {
11+
struct Vec {
1112
static_assert(S >= 2, "Vectors must have at least two values!");
1213

13-
public:
14-
using value_type = P;
14+
std::array<P, S> values;
1515

16+
// By defining these constructors, the type becomes nontrivial...
17+
#if 0
1618
constexpr Vec() = default;
1719

20+
constexpr explicit Vec(values_type vals)
21+
: values{vals} {}
22+
1823
template<std::convertible_to<P>... Vals>
1924
requires (sizeof...(Vals) == S)
2025
constexpr Vec(Vals... vals) // NOLINT(*-explicit-constructor)
2126
: values{static_cast<P>(vals)...} {}
27+
#endif
28+
29+
using value_type = P;
2230

2331
[[nodiscard]] consteval uint8_t size() const {
2432
return S;
@@ -172,9 +180,6 @@ class Vec {
172180
[[nodiscard]] constexpr bool isZero() const {
173181
return *this == zero();
174182
}
175-
176-
private:
177-
P values[S];
178183
};
179184

180185
template<Arithmetic P>

0 commit comments

Comments
 (0)