@@ -65,6 +65,11 @@ namespace modm
65
65
66
66
template <typename U>
67
67
constexpr Vector (const Vector<U, 2 > &v) : x(v.x), y(v.y) {}
68
+ // Use round() when constructing from float
69
+ // TODO This may be extended to all other constuctors as well
70
+ // DEPRICATED Replaces previously defined, specialized convert() methods below
71
+ template <std::floating_point U>
72
+ constexpr Vector (const Vector<U, 2 > &v) : x(round(v.x)), y(round(v.y)) {}
68
73
69
74
constexpr Vector (Vector<T, 1 > vx, Vector<T, 1 > vy) : x(vx.x), y(vy.x) {}
70
75
constexpr Vector (T x, Vector<T, 1 > vy) : x(x), y(vy.x) {}
@@ -162,13 +167,6 @@ namespace modm
162
167
WideType
163
168
cross (const Vector& other) const ;
164
169
165
- /* *
166
- * \brief Convert between Point-objects with different base-types
167
- */
168
- template <typename U>
169
- Vector<U, 2 >
170
- convert () const ;
171
-
172
170
/* *
173
171
* \brief Returns a perpendicular copy of the vector
174
172
*
@@ -297,33 +295,6 @@ namespace modm
297
295
template <typename U>
298
296
Vector<U, 2 >
299
297
operator / (float scale, const Vector<U, 2 > &vector);
300
-
301
- // ------------------------------------------------------------------------
302
- // Declaration of specialized methods
303
- // ------------------------------------------------------------------------
304
-
305
- template <> template <>
306
- Vector<double , 2 >
307
- Vector<float , 2 >::convert() const ;
308
-
309
- template <> template <>
310
- Vector<float , 2 >
311
- Vector<double , 2 >::convert() const ;
312
-
313
- // round for everything that's not float => double or double => float
314
- template <> template <typename U>
315
- Vector<U, 2 >
316
- Vector<float , 2 >::convert() const
317
- {
318
- return Vector<U, 2 >(round (this ->x ), round (this ->y ));
319
- }
320
-
321
- template <> template <typename U>
322
- Vector<U, 2 >
323
- Vector<double , 2 >::convert() const
324
- {
325
- return Vector<U, 2 >(round (this ->x ), round (this ->y ));
326
- }
327
298
}
328
299
329
300
#include " vector2_impl.hpp"
0 commit comments