diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-10-11 19:01:41 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-10-11 19:01:41 -0400 |
commit | dbd081ad1808d4e8550dd23971b60b862c7904e0 (patch) | |
tree | d11b86a290b3e85bc3012630678ea8b0ca99c187 /src/vZ/Vector.hpp | |
parent | 7a66711e95a97b3389a29b09aaead8cb18126e80 (diff) | |
download | vz-dbd081ad1808d4e8550dd23971b60b862c7904e0.tar.xz |
Add a test for a system of vector equations.
Diffstat (limited to 'src/vZ/Vector.hpp')
-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> |