io: move identer ostream to util namespace

This commit is contained in:
Danny Robson 2014-08-01 20:43:51 +10:00
parent a3dcdeb7a3
commit 51b119f0fc
2 changed files with 15 additions and 12 deletions

13
io.hpp
View File

@ -87,10 +87,18 @@ namespace util {
}; };
//-------------------------------------------------------------------------
template <typename T> template <typename T>
indented<T> indented<T>
make_indented (const T &_data); make_indented (const T &_data);
//-------------------------------------------------------------------------
template <typename T>
std::ostream&
operator<< (std::ostream &os, const util::indented<T> &v);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
class scoped_cwd { class scoped_cwd {
public: public:
@ -147,11 +155,6 @@ namespace util {
}; };
} }
template <typename T>
std::ostream&
operator<< (std::ostream &os, const util::indented<T> &v);
#include "io.ipp" #include "io.ipp"
#endif #endif

14
io.ipp
View File

@ -17,13 +17,13 @@ namespace util {
make_indented (const T &_data) { make_indented (const T &_data) {
return indented<T> (_data); return indented<T> (_data);
} }
}
template <typename T> template <typename T>
std::ostream& std::ostream&
operator<< (std::ostream &os, const util::indented<T> &&v) { operator<< (std::ostream &os, const util::indented<T> &&v) {
util::indenter raii (os); util::indenter raii (os);
os << v.data; os << v.data;
return os; return os;
}
} }