add additional overloads for Poco::format

This commit is contained in:
Günter Obiltschnig 2020-01-24 13:42:46 +01:00
parent 35ce47c66e
commit 701a34f2e7

View File

@ -117,7 +117,7 @@ void Foundation_API format(std::string& result, const std::string& fmt, const st
template <
typename T,
typename... Args>
void format(std::string &result, const std::string &fmt, T arg1, Args... args)
void format(std::string& result, const std::string& fmt, T arg1, Args... args)
/// Appends the formatted string to result.
{
std::vector<Any> values;
@ -129,11 +129,39 @@ void format(std::string &result, const std::string &fmt, T arg1, Args... args)
template <
typename FMT,
typename T,
typename... Args,
typename std::enable_if<std::is_const<typename std::remove_reference<FMT>::type>::value, int>::type = 0>
std::string format(FMT &fmt, T arg1, Args... args)
typename... Args>
void format(std::string& result, const char* fmt, T arg1, Args... args)
/// Appends the formatted string to result.
{
std::vector<Any> values;
values.reserve(sizeof...(Args) + 1);
values.emplace_back(arg1);
values.insert(values.end(), { args... });
format(result, fmt, values);
}
template <
typename T,
typename... Args>
std::string format(const std::string& fmt, T arg1, Args... args)
/// Returns the formatted string.
{
std::vector<Any> values;
values.reserve(sizeof...(Args) + 1);
values.emplace_back(arg1);
values.insert(values.end(), { args... });
std::string result;
format(result, fmt, values);
return result;
}
template <
typename T,
typename... Args>
std::string format(const char* fmt, T arg1, Args... args)
/// Returns the formatted string.
{
std::vector<Any> values;