Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-10-04 15:21:39 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:44:39 +0300
commitf65cafdf685416be8ff685f57f17c055ef652ac0 (patch)
tree4402e10c6039f7fa4901694a63a6cb9c93e96221 /base
parentbe22da030f81829471f223fc7b0cb502a323d7c1 (diff)
Add DebugPrint to Matrix.
Diffstat (limited to 'base')
-rw-r--r--base/logging.cpp2
-rw-r--r--base/matrix.hpp21
2 files changed, 21 insertions, 2 deletions
diff --git a/base/logging.cpp b/base/logging.cpp
index 9d5765a4f6..9f047d2a91 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -71,7 +71,7 @@ namespace my
s << " " << m_names[level];
double const sec = m_timer.ElapsedSeconds();
- s << " " << std::setfill(' ') << std::setw(16 - m_lens[level]) << sec << " ";
+ s << " " << setfill(' ') << setw(16 - m_lens[level]) << sec << " ";
}
};
diff --git a/base/matrix.hpp b/base/matrix.hpp
index 40fcf2caba..9338493728 100644
--- a/base/matrix.hpp
+++ b/base/matrix.hpp
@@ -2,6 +2,9 @@
#include "math.hpp"
+#include "../std/iomanip.hpp"
+
+
namespace math
{
template <typename T, unsigned Rows, unsigned Cols>
@@ -9,7 +12,7 @@ namespace math
{
T m_data[Rows * Cols];
- Matrix(){};
+ Matrix() {}
template <typename U>
Matrix(Matrix<U, Rows, Cols> const & src)
@@ -168,4 +171,20 @@ namespace math
}
return res;
}
+
+ template <typename T, unsigned M, unsigned N> string DebugPrint(Matrix<T, M, N> const & m)
+ {
+ ostringstream ss;
+
+ ss << ":" << endl;
+
+ for (unsigned i = 0; i < M; ++i)
+ {
+ for (unsigned j = 0; j < N; ++j)
+ ss << setfill(' ') << setw(10) << m(i, j) << " ";
+ ss << endl;
+ }
+
+ return ss.str();
+ }
}