From 283321a11dd5b6459ea358d9cd6e96513a1952a1 Mon Sep 17 00:00:00 2001 From: junwufan Date: Mon, 20 Jun 2022 00:45:38 +0800 Subject: [PATCH] =?UTF-8?q?fix=20warning=20C4717:=20'format >': recursive on all control paths, function will cause runtime stack overflow * keep origin format. --- Foundation/include/Poco/Format.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Foundation/include/Poco/Format.h b/Foundation/include/Poco/Format.h index 780f4e4c5..203f7e7ff 100644 --- a/Foundation/include/Poco/Format.h +++ b/Foundation/include/Poco/Format.h @@ -116,6 +116,9 @@ void Foundation_API format(std::string& result, const std::string& fmt, const st template < typename T, +#ifdef __cpp_lib_remove_cvref + typename std::enable_if_t, std::vector>>, +#endif typename... Args> void format(std::string& result, const std::string& fmt, T arg1, Args... args) /// Appends the formatted string to result. @@ -124,12 +127,15 @@ void format(std::string& result, const std::string& fmt, T arg1, Args... args) values.reserve(sizeof...(Args) + 1); values.emplace_back(arg1); values.insert(values.end(), { args... }); - format(result, fmt, values); + ::format(result, fmt, values); } template < typename T, +#ifdef __cpp_lib_remove_cvref + typename std::enable_if_t, std::vector>>, +#endif typename... Args> void format(std::string& result, const char* fmt, T arg1, Args... args) /// Appends the formatted string to result. @@ -138,12 +144,15 @@ void format(std::string& result, const char* fmt, T arg1, Args... args) values.reserve(sizeof...(Args) + 1); values.emplace_back(arg1); values.insert(values.end(), { args... }); - format(result, fmt, values); + ::format(result, fmt, values); } template < typename T, +#ifdef __cpp_lib_remove_cvref + typename std::enable_if_t, std::vector>>, +#endif typename... Args> std::string format(const std::string& fmt, T arg1, Args... args) /// Returns the formatted string. @@ -153,13 +162,16 @@ std::string format(const std::string& fmt, T arg1, Args... args) values.emplace_back(arg1); values.insert(values.end(), { args... }); std::string result; - format(result, fmt, values); + ::format(result, fmt, values); return result; } template < typename T, +#ifdef __cpp_lib_remove_cvref + typename std::enable_if_t, std::vector>>, +#endif typename... Args> std::string format(const char* fmt, T arg1, Args... args) /// Returns the formatted string. @@ -169,7 +181,7 @@ std::string format(const char* fmt, T arg1, Args... args) values.emplace_back(arg1); values.insert(values.end(), { args... }); std::string result; - format(result, fmt, values); + ::format(result, fmt, values); return result; }