diff --git a/include/fmt/core.h b/include/fmt/core.h index 5aef6c14..847e85e2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -318,7 +318,7 @@ constexpr bool is_integral(type t) { return t > internal::NONE && t <= internal::LAST_INTEGER_TYPE; } -constexpr bool is_numeric(type t) { +constexpr bool is_arithmetic(type t) { FMT_ASSERT(t != internal::NAMED_ARG, "invalid argument type"); return t > internal::NONE && t <= internal::LAST_NUMERIC_TYPE; } @@ -591,7 +591,7 @@ class basic_arg { internal::type type() const { return type_; } bool is_integral() const { return internal::is_integral(type_); } - bool is_numeric() const { return internal::is_numeric(type_); } + bool is_arithmetic() const { return internal::is_arithmetic(type_); } bool is_pointer() const { return type_ == internal::POINTER; } }; @@ -909,11 +909,9 @@ inline internal::named_arg arg(wstring_view name, const T &arg) { // The following two functions are deleted intentionally to disable // nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``. template -void arg(string_view, const internal::named_arg&) - FMT_DELETED_OR_UNDEFINED; +void arg(string_view, internal::named_arg) FMT_DELETED_OR_UNDEFINED; template -void arg(wstring_view, const internal::named_arg&) - FMT_DELETED_OR_UNDEFINED; +void arg(wstring_view, internal::named_arg) FMT_DELETED_OR_UNDEFINED; enum Color { BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE }; diff --git a/include/fmt/format.h b/include/fmt/format.h index eddb580d..7e5b0464 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1517,7 +1517,7 @@ class specs_checker : public Handler { private: constexpr void require_numeric_argument() { - if (!is_numeric(arg_type_)) + if (!is_arithmetic(arg_type_)) this->on_error("format specifier requires numeric argument"); } diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 1f9731a6..9a8d052c 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -450,7 +450,7 @@ void printf_context::format(basic_buffer &buffer) { if (spec.flag(HASH_FLAG) && visit(internal::IsZeroInt(), arg)) spec.flags_ &= ~internal::to_unsigned(HASH_FLAG); if (spec.fill_ == '0') { - if (arg.is_numeric()) + if (arg.is_arithmetic()) spec.align_ = ALIGN_NUMERIC; else spec.fill_ = ' '; // Ignore '0' flag for non-numeric types.