File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include < array>
34#include < cmath>
45
56#include " Integer.h"
67
78namespace sourcepp ::math {
89
910template <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
180185template <Arithmetic P>
You can’t perform that action at this time.
0 commit comments