mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Merge branch 'printf' of github.com:fmtlib/fmt
This commit is contained in:
commit
789ebea863
11
fmt/printf.h
11
fmt/printf.h
@ -517,10 +517,15 @@ void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) {
|
|||||||
write(writer_, start, s);
|
write(writer_, start, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char>
|
inline void printf(Writer &w, CStringRef format, ArgList args) {
|
||||||
void printf(BasicWriter<Char> &w, BasicCStringRef<Char> format, ArgList args) {
|
PrintfFormatter<char>(args, w).format(format);
|
||||||
PrintfFormatter<Char>(args, w).format(format);
|
|
||||||
}
|
}
|
||||||
|
FMT_VARIADIC(void, printf, Writer &, CStringRef)
|
||||||
|
|
||||||
|
inline void printf(WWriter &w, WCStringRef format, ArgList args) {
|
||||||
|
PrintfFormatter<wchar_t>(args, w).format(format);
|
||||||
|
}
|
||||||
|
FMT_VARIADIC(void, printf, WWriter &, WCStringRef)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
|
@ -500,3 +500,9 @@ TEST(PrintfTest, OStream) {
|
|||||||
EXPECT_EQ("Don't panic!", os.str());
|
EXPECT_EQ("Don't panic!", os.str());
|
||||||
EXPECT_EQ(12, ret);
|
EXPECT_EQ(12, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PrintfTest, Writer) {
|
||||||
|
fmt::MemoryWriter writer;
|
||||||
|
printf(writer, "%d", 42);
|
||||||
|
EXPECT_EQ("42", writer.str());
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user