matrix: move ostream operator into util namespace

This commit is contained in:
Danny Robson 2014-08-19 20:46:15 +10:00
parent 22dcf46c61
commit ea5f90dbf2
2 changed files with 29 additions and 22 deletions

View File

@ -405,9 +405,10 @@ namespace util {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T> namespace util {
std::ostream& template <typename T>
operator<< (std::ostream &os, const matrix<T> &m) { std::ostream&
operator<< (std::ostream &os, const matrix<T> &m) {
os << "{ {" << m.values[0][0] << ", " os << "{ {" << m.values[0][0] << ", "
<< m.values[0][1] << ", " << m.values[0][1] << ", "
<< m.values[0][2] << ", " << m.values[0][2] << ", "
@ -426,5 +427,8 @@ operator<< (std::ostream &os, const matrix<T> &m) {
<< m.values[3][3] << "} }"; << m.values[3][3] << "} }";
return os; return os;
}
} }
template std::ostream& util::operator<< (std::ostream&, const matrix<float>&);
template std::ostream& util::operator<< (std::ostream&, const matrix<double>&);

View File

@ -59,9 +59,12 @@ namespace util {
static const matrix<T> IDENTITY; static const matrix<T> IDENTITY;
static const matrix<T> ZEROES; static const matrix<T> ZEROES;
}; };
typedef matrix<float> matrixf;
template <typename T>
std::ostream& operator<< (std::ostream&, const util::matrix<T>&);
} }
template <typename T>
std::ostream& operator<< (std::ostream&, const util::matrix<T>&);
#endif #endif