21 #ifndef MIA_2D_VECTOR_HH
22 #define MIA_2D_VECTOR_HH
30 #include <type_traits>
83 template <
typename In>
95 return T(
x *
x +
y *
y);
100 return T(sqrt(
norm2()));
136 if ( a.
x == 0.0 || a.
y == 0.0)
137 throw std::invalid_argument(
"T2DVector<T>::operator /=: division by zero not allowed");
145 throw std::invalid_argument(
"T2DVector<T>::operator /=: division by zero not allowed");
188 return (
x == a.
x &&
y == a.
y);
193 return (! (*
this == a));
197 void print(std::ostream& os)
const {
214 is.clear(std::ios::badbit);
220 is.clear(std::ios::badbit);
230 is.clear(std::ios::badbit);
244 template <
typename T>
247 static const int size;
250 template <
typename T>
251 const int atomic_data<T2DVector<T> >::size = 2;
255 template <
typename T>
258 template <
typename T>
268 template <
typename T>
269 std::ostream& operator << (std::ostream& os, const T2DVector<T>& a)
282 template <
typename T>
296 template <
typename T>
312 template <
typename T,
typename S>
325 template <
typename T>
341 template <
typename T>
357 template <
typename T>
373 template <
typename T>
376 return b.
x * a.
x + b.
y * a.
y;
388 template <
typename T>
403 template <
typename T>
418 template <
typename T>
431 template <
typename T,
typename S>
434 return a.
x < b.x && a.y < b.y;
437 template <
typename T,
template <
typename>
class Vector>
441 return a.x * b.y - a.y * b.x;
453 template <
typename T>
460 template <
typename T>
463 return a.
y < b.
y || (a.
y == b.
y && a.
x < b.
x);