From e3f20d3e13b4a10f1d6788a263997016272257c3 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 7 Jul 2019 14:35:56 -0700 Subject: [PATCH] Remove gcc 4.4 workaround and use proper alias templates (#940) --- include/fmt/format.h | 41 ++++++++++++++--------------------------- include/fmt/locale.h | 4 ++-- include/fmt/ostream.h | 4 ++-- include/fmt/prepare.h | 2 +- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index d00f5a76..e0dacc1f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3340,25 +3340,17 @@ inline typename buffer_context::iterator format_to( } template -// using format_context_t = basic_format_context; -struct format_context_t { - typedef basic_format_context type; -}; +using format_context_t = basic_format_context; template -// using format_args_t = basic_format_args>; -struct format_args_t { - typedef basic_format_args::type> - type; -}; +using format_args_t = basic_format_args>; template ::value && !internal::is_contiguous_back_insert_iterator::value)> -inline OutputIt vformat_to( - OutputIt out, const S& format_str, - typename format_args_t>::type args) { +inline OutputIt vformat_to(OutputIt out, const S& format_str, + format_args_t> args) { typedef internal::output_range> range; return vformat_to>(range(out), to_string_view(format_str), args); @@ -3382,7 +3374,7 @@ inline OutputIt format_to(OutputIt out, const S& format_str, internal::is_string::value, ""); internal::check_format_string(format_str); - typedef typename format_context_t>::type context; + typedef format_context_t> context; format_arg_store as{args...}; return vformat_to(out, to_string_view(format_str), basic_format_args(as)); @@ -3396,28 +3388,24 @@ template struct format_to_n_result { }; template -struct format_to_n_context - : format_context_t, Char> {}; +using format_to_n_context = + format_context_t, Char>; template -struct format_to_n_args { - typedef basic_format_args::type> - type; -}; +using format_to_n_args = basic_format_args>; template -inline format_arg_store::type, - Args...> +inline format_arg_store, Args...> make_format_to_n_args(const Args&... args) { - return format_arg_store::type, - Args...>(args...); + return format_arg_store, Args...>( + args...); } template ::value)> inline format_to_n_result vformat_to_n( OutputIt out, std::size_t n, basic_string_view format_str, - typename format_to_n_args::type args) { + format_to_n_args args) { typedef internal::truncating_iterator It; auto it = vformat_to(It(out, n), format_str, args); return {it.base(), it.count()}; @@ -3438,10 +3426,9 @@ inline format_to_n_result format_to_n(OutputIt out, std::size_t n, const Args&... args) { internal::check_format_string(format_str); using Char = char_t; - format_arg_store::type, Args...> - as(args...); + format_arg_store, Args...> as(args...); return vformat_to_n(out, n, to_string_view(format_str), - typename format_to_n_args::type(as)); + format_to_n_args(as)); } template diff --git a/include/fmt/locale.h b/include/fmt/locale.h index 1faf9723..df8fff76 100644 --- a/include/fmt/locale.h +++ b/include/fmt/locale.h @@ -54,7 +54,7 @@ template ::value, char_t>> inline OutputIt vformat_to(OutputIt out, const std::locale& loc, const S& format_str, - typename format_args_t::type args) { + format_args_t args) { using range = internal::output_range; return vformat_to>( range(out), to_string_view(format_str), args, internal::locale_ref(loc)); @@ -66,7 +66,7 @@ template (format_str); - using context = typename format_context_t>::type; + using context = format_context_t>; format_arg_store as{args...}; return vformat_to(out, loc, to_string_view(format_str), basic_format_args(as)); diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index f589fcae..a2248bef 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -127,8 +127,8 @@ void vprint(std::basic_ostream& os, basic_string_view format_str, */ template ::value, char_t>> -inline void print(std::basic_ostream& os, const S& format_str, - const Args&... args) { +void print(std::basic_ostream& os, const S& format_str, + const Args&... args) { vprint(os, to_string_view(format_str), {internal::make_args_checked(format_str, args...)}); } diff --git a/include/fmt/prepare.h b/include/fmt/prepare.h index f72ae674..67d3f1a6 100644 --- a/include/fmt/prepare.h +++ b/include/fmt/prepare.h @@ -232,7 +232,7 @@ class prepared_format { template inline OutputIt format_to(OutputIt out, const Args&... args) const { - typedef typename format_context_t::type context; + typedef format_context_t context; typedef output_range range; format_arg_store as(args...); return this->vformat_to(range(out), basic_format_args(as));