hopefully finally fix vectors

v1
Brett 2023-04-21 21:39:34 -04:00
parent b088565d35
commit 2ad00c8895
1 changed files with 9 additions and 5 deletions

View File

@ -25,7 +25,7 @@ namespace blt {
template<typename T, uint32_t size> template<typename T, uint32_t size>
struct vec { struct vec {
protected: private:
T elements[size]{}; T elements[size]{};
public: public:
@ -39,14 +39,18 @@ namespace blt {
elements[i] = *(args.begin() + i); elements[i] = *(args.begin() + i);
} }
explicit vec(const T elem[], uint32_t v_size) { explicit vec(const T elem[size]) {
for (uint32_t i = 0; i < v_size; i++) for (uint32_t i = 0; i < size; i++)
elements[i] = elem[i]; elements[i] = elem[i];
} }
vec(const vec<T, size>& copy): vec(copy.elements, size) {} vec(const vec<T, size>& copy): vec(copy.elements) {}
template<typename o_T, uint32_t o_size> template<typename o_T, uint32_t o_size>
vec(const vec<o_T, o_size>& copy): vec(copy.elements, size) {} explicit vec(const vec<o_T, o_size>& copy) {
for (uint32_t i = 0; i < o_size; i++)
elements[i] = copy[i];
}
vec& operator=(const vec<T, size>& copy) { vec& operator=(const vec<T, size>& copy) {
if (&copy == this) if (&copy == this)