mirror of
https://github.com/fmtlib/fmt.git
synced 2025-02-04 15:40:07 +00:00
Fix format_to formatting to wmemory_buffer
This commit is contained in:
parent
dc69cc45d2
commit
cb122a4d03
@ -3457,16 +3457,17 @@ inline wformat_context::iterator vformat_to(
|
||||
return vformat_to<arg_formatter<range>>(buf, format_str, args);
|
||||
}
|
||||
|
||||
template <typename String, typename... Args,
|
||||
std::size_t SIZE = inline_buffer_size>
|
||||
inline format_context::iterator format_to(
|
||||
basic_memory_buffer<char, SIZE> &buf, const String &format_str,
|
||||
template <
|
||||
typename String, typename... Args,
|
||||
std::size_t SIZE = inline_buffer_size,
|
||||
typename Char = typename internal::format_string_traits<String>::char_type>
|
||||
inline typename buffer_context<Char>::type::iterator format_to(
|
||||
basic_memory_buffer<Char, SIZE> &buf, const String &format_str,
|
||||
const Args & ... 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...));
|
||||
buf, basic_string_view<Char>(format_str),
|
||||
make_format_args<typename buffer_context<Char>::type>(args...));
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename Char = char>
|
||||
|
@ -692,6 +692,9 @@ TEST(FormatToTest, FormatToMemoryBuffer) {
|
||||
fmt::basic_memory_buffer<char, 100> buffer;
|
||||
fmt::format_to(buffer, "{}", "foo");
|
||||
EXPECT_EQ("foo", to_string(buffer));
|
||||
fmt::wmemory_buffer wbuffer;
|
||||
fmt::format_to(wbuffer, L"{}", L"foo");
|
||||
EXPECT_EQ(L"foo", to_string(wbuffer));
|
||||
}
|
||||
|
||||
TEST(FormatterTest, Escape) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user