@@ -65,6 +65,11 @@ namespace modm
6565
6666		template <typename  U>
6767		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)) {}
6873
6974		constexpr  Vector (Vector<T, 1 > vx, Vector<T, 1 > vy) : x(vx.x), y(vy.x) {}
7075		constexpr  Vector (T x, Vector<T, 1 > vy) : x(x), y(vy.x) {}
@@ -162,13 +167,6 @@ namespace modm
162167		WideType
163168		cross (const  Vector& other) const ;
164169
165- 		/* *
166- 		 * \brief	Convert between Point-objects with different base-types 
167- 		 */  
168- 		template <typename  U>
169- 		Vector<U, 2 >
170- 		convert () const ;
171- 
172170		/* *
173171		 * \brief	Returns a perpendicular copy of the vector 
174172		 * 
@@ -297,33 +295,6 @@ namespace modm
297295	template <typename  U>
298296	Vector<U, 2 >
299297	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- 	}
327298}
328299
329300#include  " vector2_impl.hpp" 
0 commit comments