From 69f57a4730ba9b8df317c174a83350a4bc668d21 Mon Sep 17 00:00:00 2001 From: Alan De Smet Date: Fri, 22 Mar 2019 22:51:26 -0500 Subject: [PATCH] Add operator<<(istream) for size for debugging --- src/main/cpp/tiv.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/cpp/tiv.cpp b/src/main/cpp/tiv.cpp index a118b38..db3fb3f 100644 --- a/src/main/cpp/tiv.cpp +++ b/src/main/cpp/tiv.cpp @@ -396,6 +396,11 @@ struct size { size operator*(size lhs, double scale) { return size(lhs.width*scale, lhs.height*scale); } +std::ostream& operator<<(std::ostream& stream, size sz) { + stream << sz.width << "x" << sz.height; + return stream; +} + size fit_within(size container, size object) { double scale = std::min(container.width / (double) object.width, container.height / (double) object.height);