mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Minor cleanup
This commit is contained in:
@ -2701,14 +2701,10 @@ template <typename Char, typename... Args> class format_string_checker {
|
|||||||
type types_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
type types_[num_args > 0 ? static_cast<size_t>(num_args) : 1];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FMT_CONSTEXPR format_string_checker(
|
explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt)
|
||||||
basic_string_view<Char> format_str)
|
: context_(fmt, num_args, types_),
|
||||||
: context_(format_str, num_args, types_),
|
|
||||||
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
|
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
|
||||||
types_{
|
types_{mapped_type_constant<Args, buffer_context<Char>>::value...} {}
|
||||||
mapped_type_constant<Args,
|
|
||||||
basic_format_context<Char*, Char>>::value...} {
|
|
||||||
}
|
|
||||||
|
|
||||||
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
|
||||||
|
|
||||||
@ -2965,8 +2961,7 @@ template <typename... T>
|
|||||||
FMT_NODISCARD FMT_INLINE auto formatted_size(format_string<T...> fmt,
|
FMT_NODISCARD FMT_INLINE auto formatted_size(format_string<T...> fmt,
|
||||||
T&&... args) -> size_t {
|
T&&... args) -> size_t {
|
||||||
auto buf = detail::counting_buffer<>();
|
auto buf = detail::counting_buffer<>();
|
||||||
detail::vformat_to(buf, string_view(fmt),
|
detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...), {});
|
||||||
format_args(fmt::make_format_args(args...)), {});
|
|
||||||
return buf.count();
|
return buf.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3727,12 +3727,12 @@ template <typename Char> struct udl_arg {
|
|||||||
#endif // FMT_USE_USER_DEFINED_LITERALS
|
#endif // FMT_USE_USER_DEFINED_LITERALS
|
||||||
|
|
||||||
template <typename Locale, typename Char>
|
template <typename Locale, typename Char>
|
||||||
auto vformat(const Locale& loc, basic_string_view<Char> format_str,
|
auto vformat(const Locale& loc, basic_string_view<Char> fmt,
|
||||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||||
-> std::basic_string<Char> {
|
-> std::basic_string<Char> {
|
||||||
basic_memory_buffer<Char> buffer;
|
auto buf = basic_memory_buffer<Char>();
|
||||||
detail::vformat_to(buffer, format_str, args, detail::locale_ref(loc));
|
detail::vformat_to(buf, fmt, args, detail::locale_ref(loc));
|
||||||
return {buffer.data(), buffer.size()};
|
return {buf.data(), buf.size()};
|
||||||
}
|
}
|
||||||
|
|
||||||
using format_func = void (*)(detail::buffer<char>&, int, const char*);
|
using format_func = void (*)(detail::buffer<char>&, int, const char*);
|
||||||
@ -4299,9 +4299,8 @@ FMT_NODISCARD FMT_INLINE auto formatted_size(const Locale& loc,
|
|||||||
format_string<T...> fmt,
|
format_string<T...> fmt,
|
||||||
T&&... args) -> size_t {
|
T&&... args) -> size_t {
|
||||||
auto buf = detail::counting_buffer<>();
|
auto buf = detail::counting_buffer<>();
|
||||||
detail::vformat_to(buf, string_view(fmt),
|
detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...),
|
||||||
format_args(fmt::make_format_args(args...)),
|
detail::locale_ref(loc));
|
||||||
detail::locale_ref(loc));
|
|
||||||
return buf.count();
|
return buf.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user