mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-11 21:38:05 +00:00
Rename internal::is_integral and internal::is_arithmetic
To reserve space for the type traits sharing the same name as the ones from standard library.
This commit is contained in:
parent
2fd8f9ec8a
commit
8ce5f680f2
@ -671,12 +671,12 @@ FMT_TYPE_CONSTANT(const Char*, cstring_type);
|
||||
FMT_TYPE_CONSTANT(basic_string_view<Char>, string_type);
|
||||
FMT_TYPE_CONSTANT(const void*, pointer_type);
|
||||
|
||||
FMT_CONSTEXPR bool is_integral(type t) {
|
||||
FMT_CONSTEXPR bool is_integral_type(type t) {
|
||||
FMT_ASSERT(t != named_arg_type, "invalid argument type");
|
||||
return t > none_type && t <= last_integer_type;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR bool is_arithmetic(type t) {
|
||||
FMT_CONSTEXPR bool is_arithmetic_type(type t) {
|
||||
FMT_ASSERT(t != named_arg_type, "invalid argument type");
|
||||
return t > none_type && t <= last_numeric_type;
|
||||
}
|
||||
@ -905,8 +905,8 @@ template <typename Context> class basic_format_arg {
|
||||
|
||||
internal::type type() const { return type_; }
|
||||
|
||||
bool is_integral() const { return internal::is_integral(type_); }
|
||||
bool is_arithmetic() const { return internal::is_arithmetic(type_); }
|
||||
bool is_integral() const { return internal::is_integral_type(type_); }
|
||||
bool is_arithmetic() const { return internal::is_arithmetic_type(type_); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1981,20 +1981,20 @@ template <typename ErrorHandler> class numeric_specs_checker {
|
||||
: error_handler_(eh), arg_type_(arg_type) {}
|
||||
|
||||
FMT_CONSTEXPR void require_numeric_argument() {
|
||||
if (!is_arithmetic(arg_type_))
|
||||
if (!is_arithmetic_type(arg_type_))
|
||||
error_handler_.on_error("format specifier requires numeric argument");
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void check_sign() {
|
||||
require_numeric_argument();
|
||||
if (is_integral(arg_type_) && arg_type_ != int_type &&
|
||||
if (is_integral_type(arg_type_) && arg_type_ != int_type &&
|
||||
arg_type_ != long_long_type && arg_type_ != internal::char_type) {
|
||||
error_handler_.on_error("format specifier requires signed argument");
|
||||
}
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void check_precision() {
|
||||
if (is_integral(arg_type_) || arg_type_ == internal::pointer_type)
|
||||
if (is_integral_type(arg_type_) || arg_type_ == internal::pointer_type)
|
||||
error_handler_.on_error("precision not allowed for this argument type");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user