From 0978206a6ca651ff29b1cac8d12f2ff10f39de67 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 22 Feb 2014 17:06:43 +0100 Subject: [PATCH] Helper code to pretty print vectors. --- src/vectorprettyprint.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/vectorprettyprint.hpp diff --git a/src/vectorprettyprint.hpp b/src/vectorprettyprint.hpp new file mode 100644 index 0000000..b184983 --- /dev/null +++ b/src/vectorprettyprint.hpp @@ -0,0 +1,25 @@ +#ifndef idE31BEAEB229149038D67C6CF370AEEC9 +#define idE31BEAEB229149038D67C6CF370AEEC9 + +#include "vector.hpp" + +#if !defined(NDEBUG) +#include +#endif + +namespace cloonel { +#if !defined(NDEBUG) + template + inline std::ostream& operator<< (std::ostream& parOStream, const Vector& parVec) { + parOStream << "<"; + for (uint32_t z = 0; z < S - 1; ++z) { + parOStream << parVec[z] << ", "; + } + parOStream << parVec[S - 1] << ">"; + return parOStream; + } + +#endif +} //namespace cloonel + +#endif