Skip to content

Commit

Permalink
fmt: fix vsprintf receiving std::string_view (fmtlib/fmt#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kronuz committed Oct 25, 2018
1 parent c77a258 commit 7169687
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,14 @@ make_printf_args(const Args & ... args) {
typedef basic_format_args<printf_context<internal::buffer>::type> printf_args;
typedef basic_format_args<printf_context<internal::wbuffer>::type> wprintf_args;

template <typename Char>
inline std::basic_string<Char>
vsprintf(basic_string_view<Char> format,
basic_format_args<typename printf_context<
internal::basic_buffer<Char>>::type> args) {
basic_memory_buffer<Char> buffer;
inline std::string vsprintf(string_view format, printf_args args) {
memory_buffer buffer;
printf(buffer, format, args);
return to_string(buffer);
}

inline std::wstring vsprintf(wstring_view format, wprintf_args args) {
wmemory_buffer buffer;
printf(buffer, format, args);
return to_string(buffer);
}
Expand Down

0 comments on commit 7169687

Please sign in to comment.