Add operator<<(istream) for size for debugging

revert-43-persistence
Alan De Smet 2019-03-22 22:51:26 -05:00 committed by Stefan Haustein
parent b58820e647
commit 69f57a4730
1 changed files with 5 additions and 0 deletions

View File

@ -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);