diff --git a/include/rexy/detail/format/formatter.tpp b/include/rexy/detail/format/formatter.tpp index 15ea065..81ac421 100644 --- a/include/rexy/detail/format/formatter.tpp +++ b/include/rexy/detail/format/formatter.tpp @@ -299,6 +299,7 @@ namespace rexy::fmt::detail{ case presentation::string_t: break; case presentation::int_t: + case presentation::char_t: return perform_standard_format(static_cast(b), std::move(out), specs, loc); default: REXY_THROW_FORMAT_ERROR("Invalid type argument for bool"); @@ -378,7 +379,7 @@ namespace rexy::fmt::detail{ base = 2; break; case 'o': - prefix = "0"; + prefix = b == 0 ? "" : "0"; base = 8; break; case 'x': @@ -571,7 +572,7 @@ namespace rexy::fmt::detail{ const auto outputter = [&](OutIt o){ Char radix_char = '.'; o = perform_format_write_sign(std::move(o), specs.sign, f); - if(should_zero_fill && specs.width > total_width){ + if(should_zero_fill && specs.width > total_width && !(is_infinity || is_nan)){ const int fill_width = specs.width - total_width; for(int i = 0;i < fill_width;++i){ *o++ = '0'; diff --git a/include/rexy/detail/format/specs_handler.tpp b/include/rexy/detail/format/specs_handler.tpp index 0d27e4c..aacc61e 100644 --- a/include/rexy/detail/format/specs_handler.tpp +++ b/include/rexy/detail/format/specs_handler.tpp @@ -312,7 +312,7 @@ namespace rexy::fmt::detail{ if(chosen == presentation::default_t){ chosen = presentation::string_t; } - if(chosen != presentation::string_t && chosen != presentation::int_t){ + if(chosen != presentation::string_t && chosen != presentation::int_t && chosen != presentation::char_t){ REXY_THROW_FORMAT_ERROR("Invalid type specifier for bool"); } break; diff --git a/include/rexy/format.hpp b/include/rexy/format.hpp index 4eeb343..c16b3cf 100644 --- a/include/rexy/format.hpp +++ b/include/rexy/format.hpp @@ -36,6 +36,7 @@ REXY_REQUIRES_CPP20; #include "detail/format/arg_store.hpp" #include "detail/format/format_string.hpp" #include "detail/format/format_args.hpp" +#include "detail/format/format_error.hpp" #include //FILE