diff --git a/include/fmt/color.h b/include/fmt/color.h index 5c9b0491..bc534805 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -526,9 +526,9 @@ template <> struct is_string : std::false_type {}; template <> struct is_string : std::false_type {}; template -std::basic_string vformat( - const text_style& ts, basic_string_view format_str, - basic_format_args::type> args) { +std::basic_string vformat(const text_style& ts, + basic_string_view format_str, + basic_format_args > args) { basic_memory_buffer buffer; bool has_style = false; if (ts.has_emphasis()) { @@ -558,7 +558,7 @@ std::basic_string vformat( template > void vprint(std::FILE* f, const text_style& ts, const S& format, - basic_format_args::type> args) { + basic_format_args > args) { bool has_style = false; if (ts.has_emphasis()) { has_style = true; @@ -592,9 +592,9 @@ template (format_str); - typedef typename buffer_context >::type context_t; - format_arg_store as{args...}; - vprint(f, ts, format_str, basic_format_args(as)); + using context = buffer_context >; + format_arg_store as{args...}; + vprint(f, ts, format_str, basic_format_args(as)); } /** @@ -613,7 +613,7 @@ void print(const text_style& ts, const S& format_str, const Args&... args) { template > inline std::basic_string vformat( const text_style& ts, const S& format_str, - basic_format_args::type> args) { + basic_format_args > args) { return internal::vformat(ts, to_string_view(format_str), args); } diff --git a/include/fmt/core.h b/include/fmt/core.h index 524c47d4..58c716d8 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1077,7 +1077,7 @@ template class basic_format_context { public: using iterator = OutputIt; - using format_arg = basic_format_arg ; + using format_arg = basic_format_arg; template using formatter_type = formatter; /** @@ -1108,13 +1108,12 @@ template class basic_format_context { internal::locale_ref locale() { return loc_; } }; -template struct buffer_context { - typedef basic_format_context< - std::back_insert_iterator>, Char> - type; -}; -using format_context = buffer_context::type; -using wformat_context = buffer_context::type; +template +using buffer_context = + basic_format_context>, + Char>; +using format_context = buffer_context; +using wformat_context = buffer_context; /** \rst @@ -1130,8 +1129,9 @@ template class format_arg_store { // Packed is a macro on MinGW so use IS_PACKED instead. static const bool IS_PACKED = NUM_ARGS < internal::max_packed_args; - using value_type = typename std::conditional, - basic_format_arg>::type; + using value_type = + typename std::conditional, + basic_format_arg>::type; // If the arguments are not packed, add one more element to mark the end. static const size_t DATA_SIZE = @@ -1301,8 +1301,7 @@ template struct named_arg_base { basic_string_view name; // Serialized value. - mutable char - data[sizeof(basic_format_arg::type>)]; + mutable char data[sizeof(basic_format_arg>)]; named_arg_base(basic_string_view nm) : name(nm) {} @@ -1329,21 +1328,20 @@ void check_format_string(S); template ::value, char_t>> -inline format_arg_store::type, Args...> -make_args_checked(const S& format_str, const Args&... args) { +inline format_arg_store, Args...> make_args_checked( + const S& format_str, const Args&... args) { internal::check_format_string(format_str); return {args...}; } template -std::basic_string vformat( - basic_string_view format_str, - basic_format_args::type> args); +std::basic_string vformat(basic_string_view format_str, + basic_format_args> args); template -typename buffer_context::type::iterator vformat_to( +typename buffer_context::iterator vformat_to( internal::buffer& buf, basic_string_view format_str, - basic_format_args::type> args); + basic_format_args> args); } // namespace internal /** @@ -1387,12 +1385,10 @@ struct is_contiguous_back_insert_iterator> : is_contiguous {}; /** Formats a string and writes the output to ``out``. */ -template ::value, char_t>> -OutputIt vformat_to( - OutputIt out, const S& format_str, - basic_format_args::type> args) { +template , + FMT_ENABLE_IF(is_contiguous_back_insert_iterator::value)> +OutputIt vformat_to(OutputIt out, const S& format_str, + basic_format_args> args) { using container = typename std::remove_reference::type; internal::container_buffer buf((internal::get_container(out))); @@ -1413,8 +1409,7 @@ inline std::back_insert_iterator format_to( template ::value, char_t>> inline std::basic_string vformat( - const S& format_str, - basic_format_args::type> args) { + const S& format_str, basic_format_args> args) { return internal::vformat(to_string_view(format_str), args); } diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 28027a59..fa5eb6f3 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -953,7 +953,7 @@ FMT_FUNC void report_windows_error(int error_code, FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) { memory_buffer buffer; internal::vformat_to(buffer, format_str, - basic_format_args::type>(args)); + basic_format_args>(args)); fwrite_fully(buffer.data(), 1, buffer.size(), f); } diff --git a/include/fmt/format.h b/include/fmt/format.h index c8ce2f39..82f7092d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3046,7 +3046,7 @@ class format_int { template struct formatter::type, T>::value>::type> { + buffer_context, T>::value>::type> { FMT_CONSTEXPR formatter() : format_str_(nullptr) {} // Parses format specifiers stopping either at the end of the range or at the @@ -3055,8 +3055,7 @@ struct formatter handler_type; - auto type = - internal::get_type::type, T>::value; + auto type = internal::get_type, T>::value; internal::specs_checker handler(handler_type(specs_, ctx), type); auto it = parse_format_specs(ctx.begin(), ctx.end(), handler); @@ -3377,9 +3376,9 @@ std::basic_string to_string(const basic_memory_buffer& buf) { } template -typename buffer_context::type::iterator internal::vformat_to( +typename buffer_context::iterator internal::vformat_to( internal::buffer& buf, basic_string_view format_str, - basic_format_args::type> args) { + basic_format_args> args) { typedef back_insert_range> range; return vformat_to>(buf, to_string_view(format_str), args); @@ -3387,19 +3386,19 @@ typename buffer_context::type::iterator internal::vformat_to( template , FMT_ENABLE_IF(internal::is_string::value)> -inline typename buffer_context::type::iterator vformat_to( +inline typename buffer_context::iterator vformat_to( internal::buffer& buf, const S& format_str, - basic_format_args::type> args) { + basic_format_args> args) { return internal::vformat_to(buf, to_string_view(format_str), args); } template ::value, char_t>> -inline typename buffer_context::type::iterator format_to( +inline typename buffer_context::iterator format_to( basic_memory_buffer& buf, const S& format_str, const Args&... args) { internal::check_format_string(format_str); - using context = typename buffer_context::type; + using context = buffer_context; format_arg_store as{args...}; return internal::vformat_to(buf, to_string_view(format_str), basic_format_args(as)); @@ -3554,7 +3553,7 @@ inline format_to_n_result format_to_n(OutputIt out, std::size_t n, template inline std::basic_string internal::vformat( basic_string_view format_str, - basic_format_args::type> args) { + basic_format_args> args) { basic_memory_buffer buffer; internal::vformat_to(buffer, format_str, args); return fmt::to_string(buffer); diff --git a/include/fmt/locale.h b/include/fmt/locale.h index b6b4cf90..f3e3d676 100644 --- a/include/fmt/locale.h +++ b/include/fmt/locale.h @@ -15,19 +15,19 @@ FMT_BEGIN_NAMESPACE namespace internal { template -typename buffer_context::type::iterator vformat_to( +typename buffer_context::iterator vformat_to( const std::locale& loc, buffer& buf, basic_string_view format_str, - basic_format_args::type> args) { + basic_format_args> args) { typedef back_insert_range> range; return vformat_to>(buf, to_string_view(format_str), args, internal::locale_ref(loc)); } template -std::basic_string vformat( - const std::locale& loc, basic_string_view format_str, - basic_format_args::type> args) { +std::basic_string vformat(const std::locale& loc, + basic_string_view format_str, + basic_format_args> args) { basic_memory_buffer buffer; internal::vformat_to(loc, buffer, format_str, args); return fmt::to_string(buffer); @@ -37,7 +37,7 @@ std::basic_string vformat( template > inline std::basic_string vformat( const std::locale& loc, const S& format_str, - basic_format_args::type> args) { + basic_format_args> args) { return internal::vformat(loc, to_string_view(format_str), args); } diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 0399108f..4c2acf4a 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -121,7 +121,7 @@ struct convert_to_int< template void vprint(std::basic_ostream& os, basic_string_view format_str, - basic_format_args::type> args) { + basic_format_args> args) { basic_memory_buffer buffer; internal::vformat_to(buffer, format_str, args); internal::write(os, buffer); diff --git a/include/fmt/prepare.h b/include/fmt/prepare.h index 7f4ff082..9b30b5d6 100644 --- a/include/fmt/prepare.h +++ b/include/fmt/prepare.h @@ -239,14 +239,14 @@ class prepared_format { } template - inline typename buffer_context::type::iterator format_to( + inline typename buffer_context::iterator format_to( basic_memory_buffer& buf, const Args&... args) const { typedef back_insert_range> range; return this->vformat_to(range(buf), make_args_checked(format_, args...)); } private: - typedef typename buffer_context::type context; + typedef buffer_context context; template typename context::iterator vformat_to(Range out, diff --git a/test/format b/test/format index 3aca2f34..3f9f2f92 100644 --- a/test/format +++ b/test/format @@ -643,8 +643,7 @@ struct formatter { FMT_CONSTEXPR typename ParseContext::iterator parse(ParseContext& ctx) { namespace internal = fmt::internal; typedef internal::dynamic_specs_handler handler_type; - auto type = - internal::get_type::type, T>::value; + auto type = internal::get_type, T>::value; internal::specs_checker handler(handler_type(specs_, ctx), type); auto it = parse_format_specs(ctx.begin(), ctx.end(), handler);