fix: text output of 8-bit integers fixed (resolves #470)

This commit is contained in:
Mateusz Pusz committed 2023-07-05 11:24:53 +02:00
1 parent dfaf293774
commit 7b47b2fe57
2 files changed
+44 -2

No files matched your search

+5 -1
View File
@@ -34,7 +34,11 @@ namespace detail {
template<typename CharT, class Traits, auto R, typename Rep>
void to_stream(std::basic_ostream<CharT, Traits>& os, const quantity<R, Rep>& q)
{
os << q.number();
if constexpr (is_same_v<Rep, std::uint8_t> || is_same_v<Rep, std::int8_t>)
// promote the value to int
os << +q.number();
else
os << q.number();
if constexpr (has_unit_symbol(get_unit(R))) {
os << " ";
unit_symbol_to<CharT>(std::ostream_iterator<CharT>(os), get_unit(R));