From 0ea3221d34cfd5affc68fa4bdee914328f37ec3d Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 23 Sep 2018 09:44:01 -0700 Subject: [PATCH] Remove is_named_arg and add FMT_CHAR --- include/fmt/core.h | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 254f7a5b..2bb8cd06 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -447,12 +447,6 @@ struct named_arg_base; template struct named_arg; -template -struct is_named_arg : std::false_type {}; - -template -struct is_named_arg> : std::true_type {}; - enum type { none_type, named_arg_type, // Integer types should go first, @@ -1366,9 +1360,9 @@ inline typename std::enable_if< make_format_args(args...)); } -template < - typename String, - typename Char = typename internal::format_string_traits::char_type> +#define FMT_CHAR(Str) typename internal::format_string_traits::char_type + +template inline std::basic_string vformat( const String &format_str, basic_format_args::type> args) { @@ -1387,18 +1381,16 @@ inline std::basic_string vformat( \endrst */ template -inline std::basic_string< - typename internal::format_string_traits::char_type> - format(const String &format_str, const Args &... args) { +inline std::basic_string< FMT_CHAR(String) > format( + const String &format_str, const Args &... args) { internal::check_format_string(format_str); // This should be just // return vformat(format_str, make_format_args(args...)); // but gcc has trouble optimizing the latter, so break it down. - typedef typename internal::format_string_traits::char_type char_t; - typedef typename buffer_context::type context_t; + typedef typename buffer_context< FMT_CHAR(String) >::type context_t; format_arg_store as{args...}; - return internal::vformat( - basic_string_view(format_str), basic_format_args(as)); + return internal::vformat(basic_string_view< FMT_CHAR(String) >(format_str), + basic_format_args(as)); } FMT_API void vprint(std::FILE *f, string_view format_str, format_args args);