From ec5d61a7d62e31359275f1df293c18a54e33c399 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 14 Feb 2021 13:08:02 +0000 Subject: Move stream operators into ns std, add support for Arc --- utility/stream_support.hpp | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/utility/stream_support.hpp b/utility/stream_support.hpp index 9561e58..7e070b0 100644 --- a/utility/stream_support.hpp +++ b/utility/stream_support.hpp @@ -1,30 +1,40 @@ #ifndef STREAM_SUPPORT_H #define STREAM_SUPPORT_H +#include #include +#include -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] << ", "; +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"; } - 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; } - return s; -} -template -std::ostream & -operator<<(std::ostream & s, const glm::vec & v) -{ - for (int x = 0; x < L; x++) { - s << v[x] << ", "; + std::ostream & + operator<<(std::ostream & s, const Arc & arc) + { + return s << arc.first << " ↺ " << arc.second; } - return s; } #endif -- cgit v1.2.3