12
12
*/
13
13
// ----------------------------------------------------------------------------
14
14
15
- #ifndef MODM_VECTOR2_HPP
16
- #define MODM_VECTOR2_HPP
15
+ #pragma once
17
16
18
17
#include < cmath>
19
18
#include < stdint.h>
@@ -62,20 +61,13 @@ namespace modm
62
61
typedef typename GeometricTraits<T>::FloatType FloatType;
63
62
64
63
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);
79
71
80
72
inline void
81
73
setX (const T& value);
@@ -239,15 +231,15 @@ namespace modm
239
231
bool operator > (const Vector &rhs) const ;
240
232
bool operator >= (const Vector &rhs) const ;
241
233
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);
244
236
245
237
T* ptr ();
246
238
const T* ptr () const ;
247
239
248
240
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 ;
251
243
T operator * (const Vector &rhs) const ;
252
244
T operator ^ (const Vector &rhs) const ;
253
245
Vector operator * (float rhs) const ;
@@ -295,8 +287,8 @@ namespace modm
295
287
#endif
296
288
297
289
public:
298
- T x;
299
- T y;
290
+ T x = 0 ;
291
+ T y = 0 ;
300
292
301
293
protected:
302
294
template <typename U>
@@ -379,6 +371,4 @@ namespace modm
379
371
}
380
372
}
381
373
382
- #include " vector2_impl.hpp"
383
-
384
- #endif // MODM_VECTOR2_HPP
374
+ #include " vector2_impl.hpp"
0 commit comments