aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/IO.h
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2013-10-17 14:30:09 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2013-10-17 14:30:09 +0200
commit3d2a3bc755f34dd1df330aa2439ef8bacc78fe93 (patch)
tree86f0b387a6fd8f3c65a2af269ac41de5c02faaaa /Eigen/src/Core/IO.h
parentad9dc05663c75b271e2ddf8bd8d039eaa92313ef (diff)
Copy all format flags (not only precision) from actual output stream when calculating the maximal width
Diffstat (limited to 'Eigen/src/Core/IO.h')
-rw-r--r--Eigen/src/Core/IO.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h
index 6f41bdc18..b96802753 100644
--- a/Eigen/src/Core/IO.h
+++ b/Eigen/src/Core/IO.h
@@ -189,6 +189,9 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
explicit_precision = fmt.precision;
}
+ std::streamsize old_precision = 0;
+ if(explicit_precision) old_precision = s.precision(explicit_precision);
+
bool align_cols = !(fmt.flags & DontAlignCols);
if(align_cols)
{
@@ -197,13 +200,11 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
for(Index i = 0; i < m.rows(); ++i)
{
std::stringstream sstr;
- if(explicit_precision) sstr.precision(explicit_precision);
+ sstr.copyfmt(s);
sstr << m.coeff(i,j);
width = std::max<Index>(width, Index(sstr.str().length()));
}
}
- std::streamsize old_precision = 0;
- if(explicit_precision) old_precision = s.precision(explicit_precision);
s << fmt.matPrefix;
for(Index i = 0; i < m.rows(); ++i)
{