ostream operator << for range template.

This commit is contained in:
Joe Thornber 2013-05-01 16:30:59 +01:00
parent e1c5d485eb
commit 21603c5a5d

View File

@ -2,6 +2,7 @@
#define THIN_RANGE_H
#include <boost/optional.hpp>
#include <ostream>
//----------------------------------------------------------------
@ -23,6 +24,24 @@ namespace thin_provisioning {
maybe begin_;
maybe end_;
};
template <typename T>
std::ostream &
operator <<(std::ostream &out, range<T> const &r) {
if (r.begin_)
out << "[" << *r.begin_;
else
out << "[-";
out << ", ";
if (r.end_)
out << *r.end_ << "]";
else
out << "-]";
return out;
}
}
//----------------------------------------------------------------