mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
fix warning C4717: 'format<std::vector<std::any,std::allocatorstd::an… (#3640)
* fix warning C4717: 'format<std::vector<std::any,std::allocatorstd::any > >': recursive on all control paths, function will cause runtime stack overflow * keep origin format.
This commit is contained in:
@@ -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::is_same_v<std::remove_cvref_t<T>, std::vector<Any>>>,
|
||||
#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::is_same_v<std::remove_cvref_t<T>, std::vector<Any>>>,
|
||||
#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::is_same_v<std::remove_cvref_t<T>, std::vector<Any>>>,
|
||||
#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::is_same_v<std::remove_cvref_t<T>, std::vector<Any>>>,
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user