1212 */
1313// ----------------------------------------------------------------------------
1414
15- #ifndef MODM_VECTOR2_HPP
16- #define MODM_VECTOR2_HPP
15+ #pragma once
1716
1817#include < cmath>
1918#include < stdint.h>
@@ -62,20 +61,13 @@ namespace modm
6261 typedef typename GeometricTraits<T>::FloatType FloatType;
6362
6463 public:
65- /* *
66- * \brief Default-Constructor
67- *
68- * Creates a Vector with coordinates (0, 0).
69- */
70- Vector ();
71-
72- Vector (const T& inX, const T& inY);
73-
74- Vector (const Vector<T, 1 > &inX, const Vector<T, 1 > &inY);
75- Vector (const T &inX, const Vector<T, 1 > &inY);
76- Vector (const Vector<T, 1 > &inX, const T &inY);
77- explicit Vector (T inVal);
78- Vector (const Matrix<T, 2 , 1 > &rhs);
64+ constexpr Vector () = default;
65+ constexpr Vector (const T& inX, const T& inY);
66+ constexpr Vector (const Vector<T, 1 > &inX, const Vector<T, 1 > &inY);
67+ constexpr Vector (const T &inX, const Vector<T, 1 > &inY);
68+ constexpr Vector (const Vector<T, 1 > &inX, const T &inY);
69+ constexpr explicit Vector (T inVal);
70+ constexpr Vector (const Matrix<T, 2 , 1 > &rhs);
7971
8072 inline void
8173 setX (const T& value);
@@ -239,15 +231,15 @@ namespace modm
239231 bool operator > (const Vector &rhs) const ;
240232 bool operator >= (const Vector &rhs) const ;
241233
242- const T& operator [] (uint8_t index) const ;
243- T& operator [] (uint8_t index);
234+ const T& operator [] (std:: size_t index) const ;
235+ T& operator [] (std:: size_t index);
244236
245237 T* ptr ();
246238 const T* ptr () const ;
247239
248240 Vector operator - () const ;
249- Vector operator - (const Vector &rhs) const ;
250- Vector operator + (const Vector &rhs) const ;
241+ constexpr Vector operator - (const Vector &rhs) const ;
242+ constexpr Vector operator + (const Vector &rhs) const ;
251243 T operator * (const Vector &rhs) const ;
252244 T operator ^ (const Vector &rhs) const ;
253245 Vector operator * (float rhs) const ;
@@ -295,8 +287,8 @@ namespace modm
295287 #endif
296288
297289 public:
298- T x;
299- T y;
290+ T x = 0 ;
291+ T y = 0 ;
300292
301293 protected:
302294 template <typename U>
@@ -379,6 +371,4 @@ namespace modm
379371 }
380372}
381373
382- #include " vector2_impl.hpp"
383-
384- #endif // MODM_VECTOR2_HPP
374+ #include " vector2_impl.hpp"
0 commit comments