Minor cleanup

This commit is contained in:
Victor Zverovich 2022-12-30 17:08:30 -08:00
parent 6ade2eb4e5
commit aa99b86409
2 changed files with 10 additions and 16 deletions

View File

@ -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];
public:
explicit FMT_CONSTEXPR format_string_checker(
basic_string_view<Char> format_str)
: context_(format_str, num_args, types_),
explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt)
: context_(fmt, num_args, types_),
parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
types_{
mapped_type_constant<Args,
basic_format_context<Char*, Char>>::value...} {
}
types_{mapped_type_constant<Args, buffer_context<Char>>::value...} {}
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,
T&&... args) -> size_t {
auto buf = detail::counting_buffer<>();
detail::vformat_to(buf, string_view(fmt),
format_args(fmt::make_format_args(args...)), {});
detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...), {});
return buf.count();
}

View File

@ -3727,12 +3727,12 @@ template <typename Char> struct udl_arg {
#endif // FMT_USE_USER_DEFINED_LITERALS
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)
-> std::basic_string<Char> {
basic_memory_buffer<Char> buffer;
detail::vformat_to(buffer, format_str, args, detail::locale_ref(loc));
return {buffer.data(), buffer.size()};
auto buf = basic_memory_buffer<Char>();
detail::vformat_to(buf, fmt, args, detail::locale_ref(loc));
return {buf.data(), buf.size()};
}
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,
T&&... args) -> size_t {
auto buf = detail::counting_buffer<>();
detail::vformat_to(buf, string_view(fmt),
format_args(fmt::make_format_args(args...)),
detail::locale_ref(loc));
detail::vformat_to<char>(buf, fmt, fmt::make_format_args(args...),
detail::locale_ref(loc));
return buf.count();
}