Skip to content

Fix formatting under std::setw

Benedikt Conze requested to merge bconze/typed-geometry:develop into develop

The current implementation of operator<< in io.hh gives the wrong output if used in combination with std::setw: Only the type_name_prefix is formatted in the way the whole string should be formatted in.

Comparison of tg::dvec2 vs. std::complex (std::setfill for visibility): setwbug.cpp

This prints with the current implementation

**************dvec2(1, 2)
**********(3,4)
d**************vec2(1, 2)
(3,4)**********

A correct output would be

****dvec2(1, 2)
**********(3,4)
dvec2(1, 2)****
(3,4)**********

This PR fixes that by implementing operator<< similar to the operator<<-implementation for std::complex of libc++: see here, ll. 1440-1450

Merge request reports