From 21603c5a5d83c268c2154bb32eb059b8f66a35bd Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 1 May 2013 16:30:59 +0100 Subject: [PATCH] ostream operator << for range template. --- thin-provisioning/range.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/thin-provisioning/range.h b/thin-provisioning/range.h index 8345c18..9c41d9b 100644 --- a/thin-provisioning/range.h +++ b/thin-provisioning/range.h @@ -2,6 +2,7 @@ #define THIN_RANGE_H #include +#include //---------------------------------------------------------------- @@ -23,6 +24,24 @@ namespace thin_provisioning { maybe begin_; maybe end_; }; + + template + std::ostream & + operator <<(std::ostream &out, range const &r) { + if (r.begin_) + out << "[" << *r.begin_; + else + out << "[-"; + + out << ", "; + + if (r.end_) + out << *r.end_ << "]"; + else + out << "-]"; + + return out; + } } //----------------------------------------------------------------