Skip to content

Commit

Permalink
Fix error C2668 on msvc (#3378)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhaojun-Liu authored Apr 11, 2023
1 parent c98e5a0 commit 33f7150
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void print(std::wostream& os,

FMT_MODULE_EXPORT template <typename... T>
void println(std::ostream& os, format_string<T...> fmt, T&&... args) {
print(os, "{}\n", fmt::format(fmt, std::forward<T>(args)...));
fmt::print(os, "{}\n", fmt::format(fmt, std::forward<T>(args)...));
}

FMT_MODULE_EXPORT
Expand Down
2 changes: 1 addition & 1 deletion test/args-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ template <> struct formatter<custom_type> {

template <typename FormatContext>
auto format(const custom_type& p, FormatContext& ctx) -> decltype(ctx.out()) {
return format_to(ctx.out(), "cust={}", p.i);
return fmt::format_to(ctx.out(), "cust={}", p.i);
}
};
FMT_END_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion test/format-impl-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ TEST(format_impl_test, format_error_code) {
std::string msg = "error 42", sep = ": ";
{
auto buffer = fmt::memory_buffer();
format_to(fmt::appender(buffer), "garbage");
fmt::format_to(fmt::appender(buffer), "garbage");
fmt::detail::format_error_code(buffer, 42, "test");
EXPECT_EQ(to_string(buffer), "test: " + msg);
}
Expand Down
6 changes: 3 additions & 3 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ struct fmt::formatter<explicitly_convertible_to_std_string_view>
: formatter<std::string_view> {
auto format(explicitly_convertible_to_std_string_view v, format_context& ctx)
-> decltype(ctx.out()) {
return format_to(ctx.out(), "'{}'", std::string_view(v));
return fmt::format_to(ctx.out(), "'{}'", std::string_view(v));
}
};

Expand Down Expand Up @@ -1702,7 +1702,7 @@ TEST(format_test, format_examples) {
EXPECT_EQ("42", fmt::format("{}", 42));

memory_buffer out;
format_to(std::back_inserter(out), "The answer is {}.", 42);
fmt::format_to(std::back_inserter(out), "The answer is {}.", 42);
EXPECT_EQ("The answer is 42.", to_string(out));

const char* filename = "nonexistent";
Expand Down Expand Up @@ -1837,7 +1837,7 @@ TEST(format_test, join_bytes) {

std::string vformat_message(int id, const char* format, fmt::format_args args) {
auto buffer = fmt::memory_buffer();
format_to(fmt::appender(buffer), "[{}] ", id);
fmt::format_to(fmt::appender(buffer), "[{}] ", id);
vformat_to(fmt::appender(buffer), format, args);
return to_string(buffer);
}
Expand Down

0 comments on commit 33f7150

Please sign in to comment.