diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vZ/Vector.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vZ/Vector.hpp b/src/vZ/Vector.hpp index 66b9a68..0f5cf49 100644 --- a/src/vZ/Vector.hpp +++ b/src/vZ/Vector.hpp @@ -24,6 +24,7 @@ #include <algorithm> #include <cmath> #include <cstddef> +#include <ostream> namespace vZ { @@ -182,6 +183,19 @@ namespace vZ lhs.x()*rhs.y() - lhs.y()*rhs.x()); } + // Stream output + + template <std::size_t N, typename T> + std::ostream& + operator<<(std::ostream& ostr, const Vector<N, T>& v) + { + ostr << "(" << v[0]; + for (std::size_t i = 1; i < N; ++i) { + ostr << ", " << v[i]; + } + return ostr << ")"; + } + // Implementation template <std::size_t N, typename T> |