From d63f5ce1cb86e69da28bd74b21e9452dbd88a38f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 28 Feb 2021 15:42:39 +0000 Subject: Move utility to lib --- lib/stream_support.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/stream_support.hpp (limited to 'lib/stream_support.hpp') diff --git a/lib/stream_support.hpp b/lib/stream_support.hpp new file mode 100644 index 0000000..1ee1661 --- /dev/null +++ b/lib/stream_support.hpp @@ -0,0 +1,42 @@ +#ifndef STREAM_SUPPORT_H +#define STREAM_SUPPORT_H + +#include +#include +#include + +namespace std { + template + std::ostream & + operator<<(std::ostream & s, const glm::mat & m) + { + for (int y = 0; y < m.length(); y++) { + const auto & col = m[y]; + for (int x = 0; x < col.length(); x++) { + s << col[x] << ", "; + } + s << "\n"; + } + return s; + } + + template + std::ostream & + operator<<(std::ostream & s, const glm::vec & v) + { + for (int x = 0; x < L; x++) { + s << v[x] << ", "; + } + return s; + } + + inline std::ostream & + operator<<(std::ostream & s, const Arc & arc) + { + return s << arc.first << " ↺ " << arc.second; + } +} + +#define CLOG(x) std::clog << #x " : " << x << "\n"; + +#endif -- cgit v1.2.3