diff --git a/include/fmt/core.h b/include/fmt/core.h index a95c8e95..6fe15166 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1302,15 +1302,16 @@ typename std::enable_if::value>::type check_format_string(S); template -struct checked_format_args: format_arg_store< +struct checked_args: format_arg_store< typename buffer_context::type, Args...> { - checked_format_args(const S &format_str, const Args &... args): - format_arg_store< - typename buffer_context::type, Args...>(args...) { + typedef typename buffer_context::type context; + + checked_args(const S &format_str, const Args &... args): + format_arg_store(args...) { internal::check_format_string(format_str); } - basic_format_args::type> - operator*() const { return *this; } + + basic_format_args operator*() const { return *this; } }; template @@ -1362,15 +1363,15 @@ inline typename std::enable_if< const Args &... args) { return vformat_to( out, basic_string_view(format_str), - *internal::checked_format_args(format_str, args...)); + internal::checked_args(format_str, args...)); } -template -inline std::basic_string vformat( +template +inline std::basic_string vformat( const S &format_str, - basic_format_args::type> args) { + basic_format_args::type> args) { // Convert format string to string_view to reduce the number of overloads. - return internal::vformat(basic_string_view(format_str), args); + return internal::vformat(basic_string_view(format_str), args); } /** @@ -1388,7 +1389,7 @@ inline std::basic_string format( const S &format_str, const Args &... args) { return internal::vformat( basic_string_view(format_str), - *internal::checked_format_args(format_str, args...)); + *internal::checked_args(format_str, args...)); } FMT_API void vprint(std::FILE *f, string_view format_str, format_args args); @@ -1409,7 +1410,7 @@ template inline typename std::enable_if::value>::type print(std::FILE *f, const S &format_str, const Args &... args) { vprint(f, basic_string_view(format_str), - *internal::checked_format_args(format_str, args...)); + internal::checked_args(format_str, args...)); } FMT_API void vprint(string_view format_str, format_args args); @@ -1428,7 +1429,7 @@ template inline typename std::enable_if::value>::type print(const S &format_str, const Args &... args) { vprint(basic_string_view(format_str), - *internal::checked_format_args(format_str, args...)); + internal::checked_args(format_str, args...)); } FMT_END_NAMESPACE