diff --git a/include/fmt/core.h b/include/fmt/core.h index ac3db5d5..8f388f55 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -402,6 +402,12 @@ template struct is_string : std::is_class()))> { }; +template struct char_t_impl {}; +template struct char_t_impl::value>> { + using result = decltype(to_string_view(std::declval())); + using type = typename result::char_type; +}; + struct error_handler { FMT_CONSTEXPR error_handler() {} FMT_CONSTEXPR error_handler(const error_handler&) {} @@ -411,6 +417,9 @@ struct error_handler { }; } // namespace internal +/** String's character type. */ +template using char_t = typename internal::char_t_impl::type; + // Parsing context consisting of a format string range being parsed and an // argument counter for automatic indexing. template @@ -598,12 +607,6 @@ struct fallback_formatter { "an operator<< that should be used"); }; -template struct char_t_impl {}; -template struct char_t_impl::value>> { - typedef decltype(to_string_view(std::declval())) result; - typedef typename result::char_type type; -}; - template struct named_arg_base; template struct named_arg; @@ -1281,9 +1284,6 @@ struct wformat_args : basic_format_args { : basic_format_args(std::forward(arg)...) {} }; -/** String's character type. */ -template using char_t = typename internal::char_t_impl::type; - namespace internal { template FMT_CONSTEXPR typename Context::format_arg get_arg(Context& ctx, unsigned id) { @@ -1321,8 +1321,7 @@ template ::value)> void check_format_string(S); -template ::value, char_t>> +template > inline format_arg_store, Args...> make_args_checked( const S& format_str, const Args&... args) { internal::check_format_string(format_str); @@ -1403,8 +1402,7 @@ inline std::back_insert_iterator format_to( {internal::make_args_checked(format_str, args...)}); } -template ::value, char_t>> +template > inline std::basic_string vformat( const S& format_str, basic_format_args> args) { return internal::vformat(to_string_view(format_str), args); @@ -1422,8 +1420,7 @@ inline std::basic_string vformat( */ // Pass char_t as a default template parameter instead of using // std::basic_string> to reduce the symbol size. -template ::value, char_t>> +template > inline std::basic_string format(const S& format_str, const Args&... args) { return internal::vformat(to_string_view(format_str),