Skip to content

Commit 6739797

Browse files
committed
Add empty template for Sprintf
1 parent adfaf9a commit 6739797

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

paddle/fluid/string/printf.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ void Fprintf(std::ostream& out, const char* fmt, const Args&... args) {
8484
}
8585

8686
template <typename... Args>
87-
std::string Sprintf(const char* fmt = "", const Args&... args) {
87+
std::string Sprintf(const Args&... args) {
88+
if (0u == sizeof...(args)) {
89+
Sprintf("", args);
90+
}
91+
92+
return Sprintf(args, args);
93+
}
94+
95+
template <typename... Args>
96+
std::string Sprintf(const char* fmt, const Args&... args) {
8897
std::ostringstream oss;
8998
Fprintf(oss, fmt, args...);
9099
return oss.str();

0 commit comments

Comments
 (0)