Add compile-time format string checks to format_to (#783)

This commit is contained in:
Victor Zverovich 2018-07-22 15:30:51 -07:00
parent c178ab440f
commit ffe414cad1

View File

@ -3524,19 +3524,16 @@ inline wformat_context::iterator vformat_to(
return vformat_to<arg_formatter<range>>(buf, format_str, args);
}
template <typename... Args, std::size_t SIZE = inline_buffer_size>
template <typename String, typename... Args,
std::size_t SIZE = inline_buffer_size>
inline format_context::iterator format_to(
basic_memory_buffer<char, SIZE> &buf, string_view format_str,
basic_memory_buffer<char, SIZE> &buf, const String &format_str,
const Args & ... args) {
return vformat_to(buf, format_str, make_format_args(args...));
}
template <typename... Args, std::size_t SIZE = inline_buffer_size>
inline wformat_context::iterator format_to(
basic_memory_buffer<wchar_t, SIZE> &buf, wstring_view format_str,
const Args & ... args) {
return vformat_to(buf, format_str,
make_format_args<wformat_context>(args...));
internal::check_format_string<Args...>(format_str);
typedef typename internal::format_string_traits<String>::char_type char_t;
return vformat_to(
buf, basic_string_view<char_t>(format_str),
make_format_args<typename buffer_context<char_t>::type>(args...));
}
template <typename OutputIt, typename Char = char>