From 4c650057a06bf9565014269bd74a1635fdd57226 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 1 Jun 2019 12:32:24 -0700 Subject: [PATCH] FMT_CHAR -> char_t --- include/fmt/core.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index e9cea570..7bc20af0 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1352,9 +1352,10 @@ template ::value)> void check_format_string(S); -template ::value)> -inline format_arg_store::type, Args...> +template < + typename S, typename... Args, + typename Char = enable_if_t::value, fmt::char_t>> +inline format_arg_store::type, Args...> make_args_checked(const S& format_str, const Args&... args) { internal::check_format_string(format_str); return {args...}; @@ -1386,8 +1387,8 @@ typename buffer_context::type::iterator vformat_to( fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); \endrst */ -template -inline internal::named_arg arg(const S& name, const T& arg) { +template > +inline internal::named_arg arg(const S& name, const T& arg) { static_assert(internal::is_string::value, ""); return {name, arg}; } @@ -1405,11 +1406,12 @@ template struct is_contiguous> : std::true_type {}; /** Formats a string and writes the output to ``out``. */ -template -typename std::enable_if::value, - std::back_insert_iterator>::type -vformat_to(std::back_insert_iterator out, const S& format_str, - basic_format_args::type> args) { +template < + typename Container, typename S, + typename Char = enable_if_t::value, char_t>> +std::back_insert_iterator vformat_to( + std::back_insert_iterator out, const S& format_str, + basic_format_args::type> args) { internal::container_buffer buf(internal::get_container(out)); internal::vformat_to(buf, to_string_view(format_str), args); return out; @@ -1425,8 +1427,8 @@ inline std::back_insert_iterator format_to( {internal::make_args_checked(format_str, args...)}); } -template ::value)> +template ::value, char_t>> inline std::basic_string vformat( const S& format_str, basic_format_args::type> args) { @@ -1447,7 +1449,8 @@ inline std::basic_string vformat( // std::basic_string> to reduce the symbol size. template ::value, char_t>> -inline std::basic_string format(const S& format_str, const Args&... args) { +inline std::basic_string format(const S& format_str, + const Args&... args) { return internal::vformat(to_string_view(format_str), {internal::make_args_checked(format_str, args...)}); }