1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-12 20:27:06 +01:00

cout IO for all types

This commit is contained in:
Peter Boyle
2015-05-13 09:24:10 +01:00
parent 48f425d31c
commit a108d5d3b0
6 changed files with 118 additions and 8 deletions

View File

@ -95,6 +95,10 @@ public:
return *this;
}
friend std::ostream& operator<< (std::ostream& stream, const iScalar<vtype> &o){
stream<< "S {"<<o._internal<<"}";
return stream;
};
};
///////////////////////////////////////////////////////////
// Allows to turn scalar<scalar<scalar<double>>>> back to double.
@ -170,6 +174,15 @@ public:
inline const vtype & operator ()(int i) const {
return _internal[i];
}
friend std::ostream& operator<< (std::ostream& stream, const iVector<vtype,N> &o){
stream<< "V<"<<N<<">{";
for(int i=0;i<N;i++) {
stream<<o._internal[i];
if (i<N-1) stream<<",";
}
stream<<"}";
return stream;
};
// inline vtype && operator ()(int i) {
// return _internal[i];
// }
@ -262,6 +275,19 @@ public:
inline const vtype & operator ()(int i,int j) const {
return _internal[i][j];
}
friend std::ostream& operator<< (std::ostream& stream, const iMatrix<vtype,N> &o){
stream<< "M<"<<N<<">{";
for(int i=0;i<N;i++) {
stream<< "{";
for(int j=0;j<N;j++) {
stream<<o._internal[i][j];
if (i<N-1) stream<<",";
}
stream<<"}\n\t\t";
}
stream<<"}";
return stream;
};
// inline vtype && operator ()(int i,int j) {
// return _internal[i][j];