summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mmmatrix.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/mmmatrix.hpp b/include/mmmatrix.hpp
index 51233cb..7cb9359 100644
--- a/include/mmmatrix.hpp
+++ b/include/mmmatrix.hpp
@@ -11,8 +11,7 @@
*/
#pragma once
-#include <cmath>
-#include <array>
+#include <iostream>
namespace mm {
template<typename T, std::size_t Rows, std::size_t Cols>
@@ -191,3 +190,16 @@ mm::basic_matrix<T, Rows, Cols> operator-(
) {
return a + static_cast<T>(-1) * b;
}
+
+template<typename T, std::size_t Rows, std::size_t Cols>
+std::ostream& operator<<(std::ostream& os, const mm::basic_matrix<T, Rows, Cols>& m) {
+ for (int row = 0; row < Rows; row++) {
+ os << "[ ";
+ for (int col = 0; col < (Cols -1); col++) {
+ os << m.at(row, col);
+ }
+ os << m.at(Rows -1, Cols -1) << " ]\n";
+ }
+
+ return os;
+}