From 6739797d22f2fb8181b6da1cf17cc7659f61964a Mon Sep 17 00:00:00 2001 From: minqiyang Date: Mon, 2 Jul 2018 20:44:44 +0800 Subject: [PATCH] Add empty template for Sprintf --- paddle/fluid/string/printf.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/string/printf.h b/paddle/fluid/string/printf.h index e0f620250..65dec970d 100644 --- a/paddle/fluid/string/printf.h +++ b/paddle/fluid/string/printf.h @@ -84,7 +84,16 @@ void Fprintf(std::ostream& out, const char* fmt, const Args&... args) { } template -std::string Sprintf(const char* fmt = "", const Args&... args) { +std::string Sprintf(const Args&... args) { + if (0u == sizeof...(args)) { + Sprintf("", args); + } + + return Sprintf(args, args); +} + +template +std::string Sprintf(const char* fmt, const Args&... args) { std::ostringstream oss; Fprintf(oss, fmt, args...); return oss.str(); -- GitLab