mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
Copy all format flags (not only precision) from actual output stream when calculating the maximal width
This commit is contained in:
parent
965ee4e853
commit
b2368b3408
@ -185,6 +185,9 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
|
|||||||
explicit_precision = fmt.precision;
|
explicit_precision = fmt.precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::streamsize old_precision = 0;
|
||||||
|
if(explicit_precision) old_precision = s.precision(explicit_precision);
|
||||||
|
|
||||||
bool align_cols = !(fmt.flags & DontAlignCols);
|
bool align_cols = !(fmt.flags & DontAlignCols);
|
||||||
if(align_cols)
|
if(align_cols)
|
||||||
{
|
{
|
||||||
@ -193,13 +196,11 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
|
|||||||
for(Index i = 0; i < m.rows(); ++i)
|
for(Index i = 0; i < m.rows(); ++i)
|
||||||
{
|
{
|
||||||
std::stringstream sstr;
|
std::stringstream sstr;
|
||||||
if(explicit_precision) sstr.precision(explicit_precision);
|
sstr.copyfmt(s);
|
||||||
sstr << m.coeff(i,j);
|
sstr << m.coeff(i,j);
|
||||||
width = std::max<Index>(width, Index(sstr.str().length()));
|
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;
|
s << fmt.matPrefix;
|
||||||
for(Index i = 0; i < m.rows(); ++i)
|
for(Index i = 0; i < m.rows(); ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user