Fix error C2668 on msvc (#3378)

This commit is contained in:
June Liu 2023-04-11 21:27:28 +08:00 committed by GitHub
parent c98e5a08a4
commit 33f7150778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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));
}
};
@ -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";
@ -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);
}